Upload
yardley-carver
View
55
Download
3
Embed Size (px)
DESCRIPTION
Web Services 系統整合技術 與開發實務. 黃昭棋 , Brouse [email protected]. 課 程 內 容. 為什麼我們需要 Web Services ? 什麼是 Web Services 的核心技術 ? 什麼是 Web Services 的技術前沿 ? 我可以怎麼開始建構 Web Services ? 如何實作一個 Web Services ? 以 > 為例 結論與討論. 店頭市場. HTTP. 電話市場. 網路市場. - PowerPoint PPT Presentation
Citation preview
30 Aug 2005
WebSphere TopGun School
課 程 內 容 為什麼我們需要 Web Services ? 什麼是 Web Services 的核心技術 ? 什麼是 Web Services 的技術前沿 ? 我可以怎麼開始建構 Web Services ? 如何實作一個 Web Services ? 以 <<一個 Web Services架構下的投資理財管理系統 >>為例 結論與討論
30 Aug 2005
WebSphere TopGun School
創新服務的需求日益增加……………
店頭市場 電話市場
HTTP
網路市場
資料
通信通信OK??
格式格式
30 Aug 2005
WebSphere TopGun School
Web Services 要解決什麼問題 ? ------ ” 資訊孤島”
電子化政府共通作業平台
30 Aug 2005
WebSphere TopGun School
為什麼使用 ? …… Web Services
Service Requester Service Provider
ServiceProvider
ServiceProvider
ServiceProvider
降低創新服務開發總成本
30 Aug 2005
WebSphere TopGun School
系統整合為什麼青睞 Web Services?
Service Requester Service Provider
ServiceProvider
ServiceProvider
ServiceProvider
通信的成本呼叫服務的成本
http
…… 為了標準 …… 為了標準後的平台與開發工具
SOAP EnvelopSOAP Envelop
SOAP MessageSOAP MessageHTTP HeaderHTTP Header
SOAP BodySOAP Body
SOAP HeaderSOAP HeaderHeadersHeaders
Message Message SOAP
30 Aug 2005
WebSphere TopGun School
EJB
BusinessLogic
Browser
Web Services 技術架構誕生
HTTP
<HTML> <BODY> </BODY></HTML>
HTMLHTML
DBJSP
PresentationLayer
EJB
BusinessLogic
ApplicationServer
Internet
WebServiceRuntime
SOAPRouter
ServiceProxy
getQuote( )
SOAP EnvelopSOAP Envelop
SOAP MessageSOAP MessageHTTP HeaderHTTP Header
SOAP BodySOAP Body
SOAP HeaderSOAP HeaderHeadersHeaders
Message Message
SOAP EnvelopSOAP Envelop
SOAP MessageSOAP MessageHTTP HeaderHTTP Header
SOAP BodySOAP Body
SOAP HeaderSOAP HeaderHeadersHeaders
Message Message
ModularModularDescribedDescribed
PublishedPublished
FoundFoundBoundBound
InvokedInvoked
ComposedComposed
getQuote( )
Web ServiceWeb ServiceWSDLWSDL WSDLWSDL
WSDLWSDL SOAP EnvelopSOAP Envelop
SOAP MessageSOAP MessageHTTP HeaderHTTP Header
SOAP BodySOAP Body
SOAP HeaderSOAP HeaderHeadersHeaders
Message Message
SOAP EnvelopSOAP Envelop
SOAP MessageSOAP MessageHTTP HeaderHTTP Header
SOAP BodySOAP Body
SOAP HeaderSOAP HeaderHeadersHeaders
Message Message
ServiceRegistry
ServiceDescription
FindPublish
Bind ServiceRequestor
WSDL+UDDI
Service
ServiceProvider
ServiceDescription
WSDL+UDDI
30 Aug 2005
WebSphere TopGun School
Web Services 是企業能量的具體展現
店頭市場 電話市場
HTTP
網路市場
資料
通信通信OK??
格式格式<SOAP-ENV:Envelope xmlns:SOAP-ENV="..." SOAP-ENV:encodingStyle="...">
<m:getQuote xmlns:m="my-ns"> <symbol> 2330 </symbol> </m:getQuote ></SOAP-ENV:Envelope>
<SOAP-ENV:Body> <m:getQuote xmlns:m="my-ns"> <symbol> 2330 </symbol> </m:getQuote > </SOAP-ENV:Body>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="..." SOAP-ENV:encodingStyle="...">
<m:getQuote xmlns:m="my-ns"> <symbol> 2330 </symbol> </m:getQuote ></SOAP-ENV:Envelope>
<SOAP-ENV:Body> <ns1:getQuoteResponse> <return>42.50 </return> </ns1:getQuoteResponse> </SOAP-ENV:Body>
<?xml version="1.0" encoding="UTF-8"?><Quote Type=" 台股 "> <Symbol>2330</Symbol> <Name> 台積電 </Name> <Time>13:30</Time> <Date>91/08/23</Date></Quote>
<Price>42.50</Price>
<html> <title> 奇摩股市 </title> <body> <table > <tr><th> 股票代號 </th> <td>2330 台積電 </td></tr> <tr><th> 成交 </th> <td>45.00</td></tr> </table > </body></html>
<tr><th> 股票代號 </th> <td>2330 台積電 </td></tr> <tr><th> 成交 </th> <td>42.50</td></tr>
30 Aug 2005
WebSphere TopGun School
企業核心價值 --無遠弗屆的拓展
店頭市場 電話市場電話市場
加值整合市場API ( )
HTTP
網路市場網路市場
應用服務如何應用服務如何描述描述??應用服務如何應用服務如何週知週知??
應用服務如何應用服務如何啟動啟動??服務結果如何服務結果如何呈現呈現??
服務結果如何服務結果如何解讀解讀??
UDDISOAP
核心價值如何形成核心價值如何形成服務服務??Web ServicesWSDL
30 Aug 2005
WebSphere TopGun School
Web Services 三大技術主題
連結連結
安全安全 流程流程
30 Aug 2005
WebSphere TopGun School
SOAP overview
30 Aug 2005
WebSphere TopGun School
SOAP in a nutshell
An XML-based protocol with:• An envelope structure that contains a message• Encoding rules for data types• Rules for RPC requests and responses• Rules for exchanging messages using an underlying
protocol
30 Aug 2005
WebSphere TopGun School
HTTPServlet
ContainerApp.
Server
Http Request/Response
Get Request
HTTP/1.1 200 OKHTTP/1.1 200 OKServer:Server: WebSphere Application Server/4.0Content-Type:Content-Type: text/html;charset=Big5Cache-Control:Cache-Control: no-cache=“…"
Expires:Expires: Thu, 01 Dec 1994 16:00:00 GMTContent-Language:Content-Language: zhTransfer-Encoding:Transfer-Encoding: chunked<Html> …</HTML>
GETGET /Requester/JSP/main.jsp HTTP/1.1Accept:Accept: */*Accept-Language:Accept-Language: zh-twAccept-Encoding:Accept-Encoding: gzip, deflateUser-Agent:User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)Host:Host: localhost:84Connection:Connection: Keep-Alive
userID=1&StockID=2userID=1&StockID=2330330
PosPostt
?Post Request
DeleteGet
Post
Header
OptionTrace
30 Aug 2005
WebSphere TopGun School
Request and Response messages
SOAP specification defines an "envelope"
Request invokes a method on a remote object Response returns result of running the method
"envelope" wraps the message itself message is a different vocabulary namespace prefix is used to distinguish the two
parts
SOAP Message Structure
Message
SOAPEnvelop
e
Application-specific message vocabulary
SOAP envelope vocabulary
30 Aug 2005
WebSphere TopGun School
POST /SOAP_Provider/servlet/rpcrouter HTTP/1.0Host: localhostContent-Type: text/xml; charset=utf-8Content-Length: 500SOAPAction: ""
<?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<ns1:getStockQuote xmlns:ns1="http://tempuri.org/lib.webservices.YahooStockQuote" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <strSymbol xsi:type="xsd:string">2330</strSymbol> </ns1:getStockQuote> </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
A SOAP Request Message
Message
SOAPEnvelope
30 Aug 2005
WebSphere TopGun School
A SOAP Response Message
Message
SOAPEnvelope
<?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <SOAP-ENV:Body> <ns1:getStockQuoteResponse xmlns:ns1="http://tempuri.org/lib.webservices.YahooStockQuote" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <return xsi:type="xsd:string">68.5</return> </ns1:getStockQuoteResponse>
</SOAP-ENV:Body></SOAP-ENV:Envelope>
30 Aug 2005
WebSphere TopGun School
WSDL overview
30 Aug 2005
WebSphere TopGun School
Web Services Description Language
ServiceImplementation
Definition
ServiceInterfaceDefinition
Service
port
BindingPortTypeMessage
Type
AB
123
4
30 Aug 2005
WebSphere TopGun School
Service Interface Elements
Reference to data type definitions (ex. XML schema)
Contains data type definitions for messages
Abstract definition of data being transmitted
Set of abstract operations with references to messages
Concrete specification for operations and messages
import
types
message
portType
binding
30 Aug 2005
WebSphere TopGun School
<portType name="YahooStockQuote"> <operation name=“getStockQuote">
<input message=" tns:getStockQuoteRequest "/> <output message="tns:getStockQuoteResponse"/> </operation></portType>
Import java.net.*;:public class YahooStockQuote{
public String getStockQuote(String strSymbol){ { : getHTML(strSymbol); } :}
Service Interface Elements
2<message name=" getStockQuoteRequest "> <part name="strSymbol"
type="xsd:string"/></message>
<message name="setProxyResponse"> <part name="result" type="xsd:string"/></message>
Java APIJava API
getStockQuote(“23
getStockQuote(“23
30”)30”)
4
3
30 Aug 2005
WebSphere TopGun School
<binding name="YahooStockQuoteBinding" type="tns:YahooStockQuote">
<operation name=“getStockQuote">
<input name="getStockQuoteRequest">
</input> <output name="getStockQuoteResponse">
</output> </operation></binding>
Service Interface Elements
SOAPSOAP
Message
Message
1<portType name="YahooStockQuote"> <operation name=“getStockQuote"> <input message=" tns:getStockQuoteRequest "/> <output message="tns:getStockQuoteResponse"/> </operation></portType>
30 Aug 2005
WebSphere TopGun School
<binding name=" YahooStockQuoteBinding " type=" tns:YahooStockQuote ">
<operation name=" getStockQuote ">
<input name=" getStockQuoteRequest ">
</input> <output name=" getStockQuoteResponse ">
</output> </operation></binding>
Service Interface Elements
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<soap:operation soapAction="" style="rpc"/>
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://tempuri.org/lib.webservices.YahooStockQuote" use="encoded"/>
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://tempuri.org/lib.webservices.YahooStockQuote" use="encoded"/>
1
30 Aug 2005
WebSphere TopGun School
Web Services Description Language
ServiceImplementation
Definition
ServiceInterfaceDefinition
Service
port
BindingPortTypeMessage
Type
AB
123
4
30 Aug 2005
WebSphere TopGun School
WSDL Document Types
Service
Port
import
Service Implementation Binding
PortTypeMessage
Type
import
Service Interface
BindingPortTypeMessage
Type
import
Service Interface
Implementation of one or more service interfaces Contains the endpoint reference
Abstract, reusable service definition Represents a type of service that can be implemented
Service Implementation
Service Interface
30 Aug 2005
WebSphere TopGun School
<binding name="YahooStockQuoteBinding" type="tns:YahooStockQuote"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="getStockQuote"> <soap:operation soapAction="" style="rpc"/> <input name="getStockQuoteRequest"> <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://tempuri.org/lib.webservices.YahooStockQuote" use="encoded"/> </input> <output name="getStockQuoteResponse"> <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://tempuri.org/lib.webservices.YahooStockQuote" use="encoded"/> </output> </operation></binding>
Binding
<service name="YahooStockQuoteService"> <port binding="binding:YahooStockQuoteBinding“ name="YahooStockQuotePort">
<soap:address
location="http://localhost:82/SOAP_Provider/servlet/rpcrouter"/> </port>
</service>
Service Implementation Elements
AB
30 Aug 2005
WebSphere TopGun School
UDDI overview
30 Aug 2005
WebSphere TopGun School
A project to speed interoperability and adoption for web services
Partnership among industry & business leaders
Universal Description, Discovery and Integration
Standards-based specifications for service description and discovery
Shared operation of a web-based business registry
Initiated by Ariba , IBM and Microsoft Now over 300 UDDI community members
30 Aug 2005
WebSphere TopGun School
Problems UDDI SolvesA mid-sized manufacturer needs to create 400 online relationships with customers, each with their own set of standard and protocols.
BroaderB2B
A flower shop in Australia wants to be “plugged in” to every marketplace in the world, but doesn’t know how
SmarterSearch
A B2B marketplace needs to get catalog data for relevant suppliers in its industry, along with connections to shippers, insurers, etc.
Easier Aggregation
Describe Services
Discover Services
IntegrateThemTogether
Provide a standards-based profile for all electronic services that are provided. Includes web sites, other electronic resources
Web Service Visibility
Publish forAccessibility
30 Aug 2005
WebSphere TopGun School
UDDI Registry
tModelRegistrations
Businesses& Services
How UDDI Works
2) Businesses populate the registry withdescriptions of the services they support
3) UDDI manages each piece of data using a unique identifier key (either a UUID assigned by the registry, or a user supplied key)
4) Marketplaces, search engines, and business apps query the registry to discover services at other companies
1) Software companies, standards bodies and programmers populate the registry with references to these specifications (tModels)
5) Businesses use this data to facilitate easier integration with each other over the Web
30 Aug 2005
WebSphere TopGun School
Types of UDDI Registries
Private Scope• EAI catalog (entry points, data, load balancing)• Catalog for approved suppliers of goods and services• Controlled access
Semi-Private Scope• Enterprise portal - catalog of products and services for public searching• Enterprise-only publishing• Industry-specific marketplaces• Invitation-only membership for publishing• Public, invitation-only, fee-based options for searching
Public Scope• Unrestricted access to all content• Provides a “root registry” for use by other “affiliated” registries (more on
this later)• Defines public business relationships between companies…
– providers, suppliers, parents, subsidiaries, membership, certification
Many
Few
30 Aug 2005
WebSphere TopGun School
UDDIBusinessRegistry
The UDDI Business Registry Prototypical public UDDI
Registry Peer nodes (websites)
• Businesses register with any operator
• Registrations replicated hourly
• Complete set of “registered” records available at all operator nodes
Common set of SOAP APIs supported by all operators
Compliance enforced by business contract
Microsoft
SAP IBM
NTT
30 Aug 2005
WebSphere TopGun School
Registry Data
White Pages
Yellow Pages
Green Pages
Service TypeRegistration
s
Businesses register public information about themselves
Standards bodies, programmers, businesses register information about their service
30 Aug 2005
WebSphere TopGun School
Yellow Pages
Green Pages
Service TypeRegistration
s
White Pages
List of multi-language text strings
Names, phone number, fax numbers, web sites…
Business Name Text Description
Contact info
Information about Information about a a Service ProviderService Provider
Registry Data
30 Aug 2005
WebSphere TopGun School
30 Aug 2005
WebSphere TopGun School
Green Pages
Service TypeRegistration
s
White Pages
Yellow Pages
Industry : NAICS (Industry codes – US Govt.)
Product/Services : UN/SPSC(ECMA)
Location : Geographical taxonomy
3 standard taxonomies in V1
Business Business categoriescategories
Registry Data
30 Aug 2005
WebSphere TopGun School
30 Aug 2005
WebSphere TopGun School
References to specifications for Web services
Support for pointers to various file and URL based discovery mechanism if required
Technical info about services, specified by a business: how to "do e-commerce" with them
How to bind to How to bind to service providerservice provider
Service TypeRegistration
s
White Pages
Yellow Pages
Green Pages
Registry Data
30 Aug 2005
WebSphere TopGun School
30 Aug 2005
WebSphere TopGun School
JAX-RPC(JSR101)
30 Aug 2005
WebSphere TopGun School
Java API for XML based RPC (JAX-RPC) JSR 101: how Java developers use Web Services
• Covers XML based RPC Web Services over SOAP (1.1)• Objective: Improved web service interoperability with common standards
– JSR 101 clients< -- > JAX-RPC compliant server – JAX-RPC server < -- > any SOAP-RPC client
30 Aug 2005
WebSphere TopGun School
Enterprise Web Services(JSR109)
30 Aug 2005
WebSphere TopGun School
J2EE Web Services (JSR-109) JSR-109 In a nutshell
J2EE Client Container
JAXRPC
Service Stubs
Application
J2EE Web ServicesContainer
Port
ServiceImpl
ServiceDef.
Interface
BIND
Service Registry
PUBLISH FIND
Generated From
30 Aug 2005
WebSphere TopGun School
Static stub
30 Aug 2005
WebSphere TopGun School
關於 Web Services Connection如果你只想記住三件事…
定位:定位:技術:技術:
應用:應用:
Web Services Web Services 是由中央集權的 是由中央集權的 Web Web ApplicationApplication 進化到 地方分治 的系統整合技術進化到 地方分治 的系統整合技術
Web Services Web Services 是三大 標準化 技術的集成是三大 標準化 技術的集成 SOAP:SOAP: SSimpleimple OObjectbject AAccessccess PProtocolrotocol WSDL:WSDL: WWebeb SServiceervice DDescriptionescription LLanguageanguage UDDI:UDDI: UUniversalniversal DDescriptionescription DDiscoveryiscovery andand IIntegrationntegration生產力 生產力 = = 專業知識 專業知識 + + 操作工具操作工具後標準化時代 後標準化時代 的核心競爭力在於的核心競爭力在於 創新的服務
30 Aug 2005
WebSphere TopGun School
Web Services 產業面臨的挑戰
理論上理論上 ::Web Services Web Services 是是四輪傳動四輪傳動的的精心設計精心設計…………
實際上實際上 :: 這時候,我們非常需要這時候,我們非常需要 四輪傳動四輪傳動………… 而且是而且是 真正的四輪傳動。真正的四輪傳動。
30 Aug 2005
WebSphere TopGun School
Web Services 開發工具
WSAD, Visual Studio.Net, Forte… 是 Web Services 主要開發工具
IBM, Sun, Microsoft, Oracle 是 Web Services 執行環境提供者
30 Aug 2005
WebSphere TopGun School
Web Services 的特性 Services: 滿足期望的作為 Web Services: 滿足眾人期望的作為 經常,滿足「眾人」遠比滿足「期望」更 具挑戰性。以麥當勞為例。 Web Services 是以滿足眾人為前提的技術
Publish
ServiceServiceProviderProvider ServiceService
RequestorRequestor
ServiceServiceRequestorRequestor
ServiceServiceRequestorRequestor
ServiceServiceRequestorRequestor
ServiceServiceRequestorRequestor
ServiceServiceProviderProviderServiceService
ProviderProviderServiceServiceProviderProvider
ServiceServiceProviderProvider
30 Aug 2005
WebSphere TopGun School
什麼不必是 Web Services ?
單純的 RAC (Remote Application Call) 不是 Web Services
• 同一平台上的 AC ,不是 Web Services– 它連 Remote 都談不上
• 同一語言開發下的 RAC ,不必是 Web Services – proprietary call 即可,不必勞駕 SOAP
• 少數人使用的 RAC ,不必是 Web Services– proprietary IDL 即可,不必勞駕 WSDL
• 多數人已知道的 RAC ,不必是 Web Services– 媒介機制已存在,不必勞駕 UDDI
殺雞不必用牛刀!
30 Aug 2005
WebSphere TopGun School
我該開始進行 Web Services !? 如果你對這問題應對自如…… 『貴公司的產品是 Web-based ?』 也企圖對這問題侃侃而談…… 『貴公司的產品是 Web Services-based ?』 那麼請把這問題反問你的 platform Vendor 、 你的委外廠商 (external) 以及你的事業夥伴 (internal)…… 當他們都有看法時,最適當的時機可能已經錯過?
30 Aug 2005
WebSphere TopGun School
Web Services 技術總整理
XMLXML
SOAPSOAP
ebXMLebXML
UDDIUDDI
Visi
bilit
y
Trough ofDisillusionment
Slope ofEnlightenment
Plateau ofProductivity
TechnologyTrigger
Real Peak ofInflated
Expectations Maturity
BPELBPEL
WS-IWS-I
WSRPWSRP
LibertyLiberty
WS-SecurityWS-Security
XACMLXACMLSAMLSAML
XML SignatureXML Signature
XKMSXKMS
XML EncryptionXML Encryption
WSDLWSDLWS-CoordinationWS-CoordinationWS-TransactionWS-Transaction
Key: Time to “plateau”Less than two yearsTwo to three yearsThree to five years
30 Aug 2005
WebSphere TopGun School