41
SOAP, WSDL, UDDI

SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

Embed Size (px)

Citation preview

Page 1: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

SOAP, WSDL, UDDI

Page 2: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

Service Broker

Basic SOAP Message Exchange

ServiceConsumer

Service Provider

http transport

SOAPmessage

WSDLdescribing

service

SOAPmessage

httptransport

client service

registryfind

publish

DESCRIBE

INVOKE

SOAP Sender SOAP Receiver

SOAP SenderSOAP Receiver

Page 3: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

SOAP Body

SOAP Message

SOAP header

SOAP envelope

Header block

Header data

Header data

Header data

Body child element

Body child element

Page 4: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

SOAP Building Blocks

• A SOAP message is an XML document with the following elements – A required envelope

• Identifies XML document as a SOAP message

– An optional header • Contains header information

– A required body element with call and response information

– An optional fault element • Information about errors that could occur

Page 5: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

Sample SOAP Message<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">

<env:Header> <n:alertcontrol xmlns:n="http://example.org/alertcontrol">

<n:priority>1</n:priority>

<n:expires>2001-06-22T14:00:00-05:00</n:expires> </n:alertcontrol> </env:Header>

<env:Body> <m:alert xmlns:m="http://example.org/alert"><m:msg>Pick up Mary at school at 2pm</m:msg></m:alert>

</env:Body>

</env:Envelope>

Page 6: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

SOAP Envelope Element

• Required field – tells that this XML document is a SOAP message

• Encoding style attribute – used to define data types used in the document

<?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> ... Message information goes here ... </soap:Envelope>

Page 7: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

SOAP Header

• Contains application specific information (e.g. authentication, payment, etc.)

• Optional field, but if present, must be the first child of the envelope element

<?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Header><m:Trans xmlns:m=http://www.w3schools.com/transaction/ soap:mustUnderstand="1">234</m:Trans> </soap:Header>... .. .</soap:Envelope>

Page 8: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

SOAP Header – Contd.

• The previous example contains – A Trans element, which is an actor – mustUnderstand attribute of 1 – A value of 234, which denotes an encoding style

• Actor attribute – Message may pass multiple nodes – we need to

denote who needs to act on it

• mustUnderstand – whether a header entry is madatory or optional for the recipient to process

Page 9: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

SOAP Body

• Actual message

<?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Body> <m:GetPrice xmlns:m="http://www.w3schools.com/prices"> <m:Item>Apples</m:Item> </m:GetPrice> </soap:Body>

</soap:Envelope>

Page 10: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

Response

<?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Body> <m:GetPriceResponse xmlns:m="http://www.w3schools.com/prices"> <m:Price>1.90</m:Price> </m:GetPriceResponse> </soap:Body>

</soap:Envelope>

Page 11: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

SOAP Fault Element

• Error message from a SOAP message is carried inside a fault element

• Must appear as a child element of the body element

• Has the following subelements: – Faultcode - identifies the fault – Faultstring – human readable explanation of the fault – Fault-factor – what caused the fault – Details -- application specific information

Page 12: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

A More Involved Example

buyer

seller

seller

seller

messagebroker

RFQ

QuoteResponse

Award

Page 13: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

Conversational SOAP 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=“http://bigco.example.org/RFQ” 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:substitutable/>– <r:quantity>100</r:quantity></r:RFQ>

– </env:Body>• </env:Envelope>

Page 14: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

Conversational 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:RFQNum>• <r:custNum env:mustUnderstand=“true”>17<r:custNum>

– </env:Header>– <env:Body>

• <r:quoteRespons 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:VendorName URL=“http://memunlim.com”>Memories

Unlimited</r:VendorName>– <r:SKU>KM-SD1000</r:SKU>– <r:quantity>100</r:quantity>

• </r:quoteResponse>– </env:Body>

</env:Envelope>

Page 15: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

Conversational 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>

Page 16: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

Remote Procedure Calls

• To invoke RPC– Address of target SOAP node– Method name– Identities and values of arguments– Separation of arguments identifying target of

RPC versus data• Plus values of properties for binding (e.g. GET,

POST)

– Optional header data

Page 17: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

RPC Invocation<?xml version='1.0' ?><env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">

<env:Header><t:transaction xmlns:t=“http://shippingservice.org/transaction” env:encodingStyle=“http://shippingservice.org/encoding” env:mustUnderstand=“true”>5</t:transaction></env:Header>

<env:Body><s:shipOrder xmlns:s=“http://shippingservice.org”><s:origin env:encodingStyle="http://www.w3.org/2003/05/soap-encoding" >

<r:vendorID xmlns:r=“http://bigco.example.org/RFQ”>2470

</r:vendorID></s:origin><s:destination>

<r:custNum env:mustUnderstand=“true”>17<r:custNum></s:destination><s:weight>500g</s:weight></s:shipOrder>

</env:Body> </env:Envelope>

Page 18: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

RPC Result<?xml version='1.0' ?><env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"

><env:Header><t:transaction xmlns:t=“http://shippingservice.org/transaction” env:encodingStyle=“http://paymentservice.org/encoding” env:mustUnderstand=“true”>5</t:transaction></env:Header>

<env:Body><s:shipOrderResponse env:encodingStyle=“http://www.w3.org/2003/05/soap-encoding”xmlns:rpc=“http://www.w3.org/2003/05/soap-rpc”xmlns:s=“http://shippingservice.org”>

<rpc:result>s:status</rpc:result><s:status>confirmed</s:status><s:amount>$20.00</s:amount>

</s:shipOrderResponse></env:Body> </env:Envelope>

Page 19: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

SOAP Faults

Place faults inside env:Body elementsIn single env:Faultenv:Node identifies node which generated fault

Absence indicates “ultimate recipient”env:Code

env:Valueenv:Subcode

env:Reasonenv:Text

env:DetailApplication specific

Page 20: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

SOAP Fault Example<?xml version='1.0' ?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"

xmlns:rpc='http://www.w3.org/2003/05/soap-rpc'> <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/faults"> <e:message>Unknown destination</e:message> <e:errorcode>999</e:errorcode>

</e:myFaultDetails> </env:Detail>

</env:Fault> </env:Body> </env:Envelope>

Page 21: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

SOAP Processing Model• SOAP messages are sent from one sender node passing through

zero or more intermediaries• Three roles

– next: each SOAP intermediary or end destination must act in this role– none: SOAP nodes must not act in this role– ultimateReceiver: destination acts in this role

• Header blocks targeted to specific roles using Role attribute• If mustUnderstand=“true” SOAP receiver must understand or

generate SOAP fault• Header blocks processed by intermediaries are generally removed

before forwarding– Override with relay attribute– Allows targeting of headers to specific intermediaries (but

mustUnderstand would then generally be turned off)

Page 22: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

SOAP Processing: Header Blocks, MustUnderstand and Relay

<?xml version="1.0" ?> <env:Envelope

xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header>

<p:oneBlock xmlns:p="http://example.com" env:role="http://example.com/Log" env:mustUnderstand="true"> ... </p:oneBlock>

<q:anotherBlock xmlns:q="http://example.com" env:role="http://www.w3.org/2003/05/soap-envelope/role/next" env:relay="true"> ... ...</q:anotherBlock>

<r:aThirdBlock xmlns:r="http://example.com"> ... ... </r:aThirdBlock>

</env:Header>

<env:Body > ... ... </env:Body></env:Envelope>

Page 23: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

SOAP Remoting ArchitectureSOAP Remoting Architecture

Server objectimplementation

application level

Client application code

Server skeleton

XML unmarshaller

Client stub

XML marshaller

TCP/IP socket

remoting architecture level

wire protocol levelhttp protocol http

serverhttp

server

body

envelopeheader header

Page 24: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

Web Services Description Language

• Provides a model and an XML format for the “contract” of a web service

• Separates abstract service description from both concrete network protocol and message format

• Describes data types used in messages• Messages are defined as aggregation of typed

parts• Operations are message exchange patterns

supported by the web service• PortTypes are named collections of operations

Page 25: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

WSDL Specification

types

message message message

operation

porttype

operation operation

binding

serviceport

Page 26: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

WSDL: More Basics

• Define services as collections of network endpoints or ports

• Messages are abstract descriptions of data being exchanged

• Port types are abstraction collection of operations

• Concrete protocol and data format specification for a particular porttype constitutes a binding

Page 27: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

WSDL Components

• Types– a container for data type definitions using some type system

• Message– an abstract, typed definition of the data being communicated.

• Operation– an abstract description of an action supported by the service.

• Port Type–an abstract set of operations supported by one or more endpoints.

• Binding– a concrete protocol and data format specification for a particular port type

• Port– a single endpoint defined as a combination of a binding and a network address.

• Service– a collection of related endpoints.

Page 28: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

An Example - WSDL Types<?xml version="1.0"?> <definitions name="StockQuote"

targetNamespace="http://example.com/stockquote.wsdl" xmlns:tns="http://example.com/stockquote.wsdl" xmlns:xsd1="http://example.com/stockquote.xsd" xmlns:soap="http://schems.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/">

<types> <schema targetNamespace="http://example.com/stockquote.xsd" xmlns="http://www.w3.org/2000/10/XMLSchema"> <element name="TradePriceRequest">

<complexType><all><element name="tickerSymbol" type="string"/> </all>

</complexType> </element> <element name="TradePrice">

<complexType><all><element name="price” type="float"/></all></complexType>

</element> </schema></types>

Page 29: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

WSDL Operations

<message name="GetLastTradePriceInput"> <part name="body" element="xsd1:TradePriceRequest"/> </message>

<message name="GetLastTradePriceOutput"> <part name="body" element="xsd1:TradePrice"/></message>

<portType name="StockQuotePortType"><operation name="GetLastTradePrice">

<input message="tns:GetLastTradePriceInput"/> <output message="tns:GetLastTradePriceOutput"/> </operation>

</portType>

Page 30: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

WSDL Bindings, Services, Ports

<binding name="StockQuoteSoapBinding" type="tns:StockQuotePortType">

<soap:binding style="document“ transport="http://schemas.xmlsoap.org/soap/http"/>

<operation name="GetLastTradePrice"> <soap:operation

soapAction="http://example.com/GetLastTradePrice"/> <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:StockQuoteBinding">

<soap:address location="http://example.com/stockquote"/> </port> </service> </definitions>

Page 31: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

More on Messages

• Messages consist of one or more logical parts

• Each part is associated with a type

<definitions .... > <message name="nmtoken"> * <part name="nmtoken" element="qname"? type="qname"?/> * </message> </definitions>

Page 32: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

More on Messages

• Multiple part elements are used if the message has multiple logical units

• Abstract vs. Concrete messages – Message definitions are abstract – Message binding describes how the abstract

content is mapped to a concrete format – Bindings may provide very limited information

is they are close

Page 33: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

Operations

<wsdl:definitions .... > <wsdl:portType .... > * <wsdl:operation name="nmtoken" parameterOrder="nmtokens"> <wsdl:input name="nmtoken"? message="qname"/>

<wsdl:output name="nmtoken"? message="qname"/> <wsdl:fault name="nmtoken" message="qname"/>*

</wsdl:operation> </wsdl:portType > </wsdl:definitions>

Page 34: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

Port Types

• A port type is a named set of abstract operations and abstract messages

Page 35: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

WSDL Binding

• maps the abstract service functionality to a specific network protocol and message format

• defines:– the communication protocol to use– how service interactions are accomplished using this

protocol– the address to communicate with

• Three bindings are defined in the WSDL spec:– SOAP binding– HTTP binding– SMTP binding

Page 36: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

WSDL Binding Example:One-way Over SMTP

• <message name="SubscribeToQuotes"> <part name="body" element="xsd1:SubscribeToQuotes"/>– <part name="subscribeheader" element="xsd1:SubscriptionHeader"/>

• </message> • <portType name="StockQuotePortType">

– <operation name="SubscribeToQuotes"> • <input message="tns:SubscribeToQuotes"/>• </operation>

– </portType>• <binding name="StockQuoteSoap" type="tns:StockQuotePortType">

– <soap:binding style="document" transport="http://example.com/smtp"/> – <operation name="SubscribeToQuotes"> – <input message="tns:SubscribeToQuotes"> – <soap:body parts="body" use="literal"/> – <soap:header message="tns:SubscribeToQuotes" part="subscribeheader"

use="literal"/>– </input> – </operation>

• </binding> • <service name="StockQuoteService">

– <port name="StockQuotePort" binding="tns:StockQuoteSoap"> • <soap:address location="mailto:[email protected]"/>

– </port> • </service>

Page 37: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

Request-Response RPC Over HTTP

<binding name="StockQuoteSoapBinding" type="tns:StockQuotePortType"> • <soap:binding style="rpc"

transport="http://schemas.xmlsoap.org/soap/http"/> • <operation name="GetTradePrice">

– <soap:operation soapAction="http://example.com/GetTradePrice"/> – <input>

<soap:body use="encoded" namespace="http://example.com/stockquote" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

– </input> – <output>

<soap:body use="encoded" namespace="http://example.com/stockquote" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

– </output> • </operation>> </binding>

<service name="StockQuoteService"> <documentation>My first service</documentation><port name="StockQuotePort" binding="tns:StockQuoteBinding"> <soap:address location="http://example.com/stockquote"/></port>

</service>

Page 38: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

UDDI:Why Do We Need a Web Services Registry

• Web services are valuable because of standardized payloads and transport definitions– The value is creating a web service that is

used by many clients

• Can’t happen unless the services are advertised to multiple consumers

Page 39: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

What Does UDDI Contain?

• Businesses and other service providers

• Services they expose

• Bindings (locations) of those services

• Interfaces supported by those services

Page 40: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

UDDI Entities

• 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

• Subscription – request to be informed of particular changes

Page 41: SOAP, WSDL, UDDI. Service Broker Basic SOAP Message Exchange Service Consumer Service Provider http transport SOAP message WSDL describing service SOAP

Core UDDI Entities

businessService

businessService

Interface tModelbindingTemplate

bindingTemplate

businessEntity

bindingTemplateInterface tModel