View
223
Download
0
Category
Preview:
Citation preview
In Introduction to Web Services
Publish-Find-Bind
ConsumingProgram
Service Requestor
ServiceProvider
http transport
SOAPmessage
Service Registry
UDDI
Discover services
SOAPmessagehttp transport
Publish services
WSDLdescribing
service
SOAP Message•Body - Payload
•Why header?
• Extensibility
• Control/meta Information
•Header is optional
•SOAP Intermediaries
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
...</env:Header>
<env:Body>
... </env:Body>
</env:Envelope>
SOAP ArchitectureService
implementationapplication levelClient application
code
Server skeleton
XML unmarshallerClient stub
XML marshaller
TCP/IP socket
remoting architecture level
wire protocol levelhttp protocol httpserver
httpclient
body
envelopeheader header
buyer
seller
seller
seller
messagebroker
RFQ
QuoteResponse
Award
Conversational Message Exchange
Conversational Message Exchange: A Request
<?xml version='1.0' ?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header> <r:RFQNum xmlns:r=“…” env:mustUnderstand=“true”>101</r:RFQNum><r:custNum env:mustUnderstand=“true”>17</r:custNum></env:Header>
<env:Body><r:RFQ xmlns:r=“http://bigco.example.org/RFQ”>
<r:manufacturer>SanDisk</r:<Manufacturer><r:productname>SecureDigital memory</r:productname><r:size>1GB</r:size><r:quantity>100</r:quantity>
</r:RFQ></env:Body>
</env:Envelope>
Conversational Message Exchange: A Response
<?xml version='1.0' ?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header>
<r:RFQNum xmlns:r=“http://bigco.example.org/RFQ”>env:mustUnderstand=“true”>101</m:RFQNum><r:vendorID env:mustUnderstand=“true”>2470</r:vendorID><r:bidNum env:mustUnderstand=“true”>1</r:bidNum><r:custNum env:mustUnderstand=“true”>17<r:custNum>
</env:Header>
<env:Body><r:quoteResponse xmlns:r=“http://bigco.example.org/RFQ”>
<r:manufacturer>KingMax</r:<Manufacturer><r:productName>SecureDigital memory</r:productname><r:size>1GB</r:size><r:speed>9000KB/s</r:speed><r:SKU>KM-SD1000</r:SKU><r:quantity>100</r:quantity>
</r:quoteResponse></env:Body>
</env:Envelope>
Conversational Message Exchange: Completion
<?xml version='1.0' ?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header> <r:vendorID env:mustUnderstand=“true”>2470</r:vendorID>
<r:bidNum env:mustUnderstand=“true”>1</r:bidNum>
<r:custNum env:mustUnderstand=“true”>17<r:custNum>
</env:Header><env:Body>
<r:Award xmlns:r=“http://bigco.example.org/RFQ”>
<r:SKU>KM-SD1000</r:SKU>
<r:quantity>50</r:quantity>
</r:Award>
</env:Body>
</env:Envelope>
SOAP Faults
• Place faults inside env:Body elements
• env:Fault Element:
• env:Node identifies node which generated fault• Absence indicates “ultimate recipient”
• env:Code • env:Value• env:Subcode
• env:Reason• env:Text
• env:Detail• Application specific
SOAP Fault Examples<env:Body>
<env:Fault> <env:Code>
<env:Value>env:Sender</env:Value> <env:Subcode>
<env:Value>rpc:BadArguments</env:Value></env:Subcode>
</env:Code> <env:Reason>
<env:Text xml:lang="en-US">Processing error</env:Text> <env:Text xml:lang="cs">Chyba zpracování</env:Text>
</env:Reason> <env:Detail>
<e:myFaultDetails xmlns:e=http://shippingservice.org/fault><e:message>Unknown destination</e:message> <e:errorcode>999</e:errorcode> </e:myFaultDetails>
</env:Detail> </env:Fault>
</env:Body>
SOAP Bindings• Transport of SOAP messages from one SOAP node to another
• Serialized representation of the message POST /Reservations HTTP/1.1Host: marketplace.example.orgContent-Type: application/soap+xml; charset="utf-8"Content-Length: nnnn<?xml version='1.0' ?><env:Envelope xmlns:env=”...”><env:Body>…
From: buyer@bigco.example.orgTo: rfqs@marketplace.example.orgSubject: RFQ: Memory purchaseDate: Thursday, September 9 2004Message-Id: <17-101@bigco.example.org>Content-Type: application/soap+xml<?xml version='1.0' ?><env:Envelope xmlns:env=”...”><env:Body>…
WSDL: Introduction• Contract of a web service published by the provider• XML-based Service Description • W3C Candidate Recommendation
• Describe a Web Service?• Operations• Message Exchange Pattern• Messages• Protocol, Address
• WSDL Approach:• Abstract service description• Concrete network protocol and message format• Binding [Abstract -> Concrete]
WSDL: Specification<definitions
name="StockQuote" … >
<types>…</types>
<message>…</message>
<portType>
<operation>
…
</operation>
</portType>
<binding>…</binding>
<service>…</service>
</definitions>
types
message message message
operation
portType/interface
operation operation
binding
serviceport / endpoint
WSDL TypesData type definitions using some type system (such as XSD)
<types> <schema targetNamespace=“…“ xmlns="http://www.w3.org/....">
<complexType name=“StockIdentifier"> <sequence> <element name=“Symbol“ type="xsd:string"/> <element name=“StockMarket“
type="xsd:sting"/> </sequence></complexType>
</schema></types>
External Schemas can be imported into the WSDL
<import namespace="http://example.com/stockquote/schemas" location=http://example.com/stockquote/stockquote.xsd />
WSDL PortType, Operation, Message
<portType name="StockPriceInterface">
<operation name=“GetStockPrice">
<input message="tns:GetStockPriceInput"/>
<output message="tns:GetStockPriceOutput"/>
</operation>
</portType>
<message name="GetStockPriceInput">
<part name=“stock" element=“xsd1:StockIdentifier"/>
<part name=“time" element="xsd:date"/>
</message>
<message name="GetStockPriceOutput">
<part name=“stock" element=“xsd1:StockIdentifier"/>
<part name=“value" element="xsd:float"/>
</message>
WSDL Binding• Maps the abstract service functionality to a specific network protocol and
message format
• Bindings defined for HTTP, SMTP etc..
<binding name="StockQuoteSOAPBinding" type="tns:StockQuotePortType">
<soap:binding style="document“ transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="GetStockPrice"><soap:operation soapAction="http://example.com/GetStockPrice"/>
<input><soap:body use="literal"/></input> <output><soap:body use="literal"/></output>
</operation>
</binding>
<service name="StockQuoteService">
<documentation>My first service</documentation>
<port name="StockQuotePort" binding="tns:StockQuoteSOAPBinding">
<soap:address location="http://example.com/stockquote"/>
</port>
</service>
WSDL Ports and Services
Port: A single endpoint defined as a combination of a binding and a network address.
Service: A collection of related endpoints.
WSDL Binding Example:One-way Over SMTP<message name="SubscribeToQuotes">
<part name=“subsBody" element="xsd1:SubscribeToQuotes"/>
<part name="subsHeader"element="xsd1:SubscriptionHeader"/>
</message>
<portType name="StockQuotePortType">
<operation name="SubscribeToQuotesOper"> <input message="tns:SubscribeToQuotes"/>
</operation>
</portType>
<binding name="StockQuoteSoap" type="tns:StockQuotePortType">
<soap:binding style="document" transport="http://example.com/smtp"/><operation name="SubscribeToQuotesOper">
<input message="tns:SubscribeToQuotes"> <soap:body parts=“subsBody" use="literal"/> <soap:header part="subsHeader" use="literal"/>
</input> </operation>
</binding>
<service name="StockQuoteService">
<port name="StockQuotePort" binding="tns:StockQuoteSoap"> <soap:address location="mailto:subscribe@example.com"/>
</port>
</service>
UDDI
• Universal Description, Discovery and Integration
• businessEntity - Provider of service
• businessService - Collection of related services
• bindingTemplate - Information necessary to use
• tModel - “reusable concept” such as• Interface• Protocol used by web services• Category
• publisherAssertion - Relationship that business entity has with another businessEntity
• UUID (Universally Unique IDs) as Keys• businessKey, serviceKey, bindingKey , tModelKey
businessService
businessService
Interface tModelbindingTemplate
bindingTemplate
businessEntity
bindingTemplate
Interface tModel
Core UDDI Entities
tModels
• The “technical fingerprint”• tModel’s define unique identifiers for interfaces and interface
specifications• Once tModel is published service advertises compliance with the
spec represented by including the correct tModelKey
• Value sets• Categorization hierarchies• E.g. categoryBag and identifierBag have references to tModels with
the system of values
UDDI APIs• Inquiry
• Browse: find_xx• Drill-down: get_xx
• Invocation• Use browse and drilldown and get bindingTemplate• Invoke from bindingTemplate
• Publication• save_xx• delete_xx
• Subscription, Security, Custody Transfer, Replication
<find_business xmlns="urn:uddi-org:api_v3">
<findQualifiers><findQualifier>uddi:uddi.org:findqualifier:approximatematch</findQualifier>...
</findQualifiers>
<categoryBag><keyedReference keyValue="34.10.%“
tModelKey="uddi:uddi.org:ubr:categorization:unspsc"/></categoryBag>
</find_business>
Mapping WSDL to UDDI
The value proposition of SOA• Implement SOA for two major reasons.
• First is the ability to save development dollars through reuse of services.
• Second is the ability to change the IT infrastructure faster to adapt to changing needs of the business, or agility.
The vision: a true SOA Scenario•Describe the semantics of a client’s need
•Discover a provider of this need or compose multiple services dynamically
•Dynamically understand the protocol of messages to be exchanged with the provider
•Negotiate terms of use of a Service
•Move from one provider to another seamlessly
SOA Fabric Requirements
• Publish-Find-Bind paradigm++• Semantics (IOPE)• Context awareness• Trust models• Declarative and dynamic composition• Fabric services similar to “middleware services” of the
past• Transactions, naming etc. • Non repudiation• Metering and Billing (S-Commerce)• Differentiated service levels along with dynamic
provisioning of services
Whither WS?
• Many new standards are being formulated that extend WS with these capabilities• WSRF – for stateful interactions• WS Policy – Capabilities and constraint specification• C-WSDL – Context awareness • WS-Coordination – Orchestration• WS-Transactions – Transaction API
• Impact?• Certainly extend it’s usefulness• But …..
Recommended