SCDJWS 3. WSDL

1,991 views

Published on

Refers to:
1. SCDJWS 5.0 Study Guide by Mikalai Zaikin
2. SCDJWS 5 Study Notes by Ivan A Krizsan

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,991
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
189
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

SCDJWS 3. WSDL

  1. 1. <ul>WSDL </ul><ul>Francesco Ierna </ul>
  2. 2. <ul>WSDL </ul><ul><li>WSDL is : </li></ul><ul><ul><li>XML Documents that allows formal XML descriptions of interfaces of Web Services. WSDL is an XML format for describing network services as a set of endpoints operating on messages containing either document-oriented or procedure-oriented information. </li><ul><li>All possible functions into the interfaces. The operations and messages are described abstractly </li></ul></ul></ul><ul><ul><ul><li>Data type information for all message requests and for message response
  3. 3. Binding information about transport protocol to be used
  4. 4. Address information for locating the specified service. </li></ul></ul><li>Two layers : </li><ul><li>Service definition layers </li><ul><li>Data types
  5. 5. Message types
  6. 6. Operations
  7. 7. Services </li></ul><li>Binding layers </li><ul><li>Protocols
  8. 8. Data format </li></ul></ul></ul>
  9. 9. Example : WSDL
  10. 10. Example : WSDL
  11. 11. Example : WSDL
  12. 12. Example : WSDL
  13. 13. Example : WSDL
  14. 14. < definitions > <!-- root WSDL element --> < types > <!-- defines data types to be transmitted --> </ types > < message > <!-- defines messages to be transmitted -> </ message > < portType > <!-- defines operations (functions) to be supported --> </ portType > < binding > <!-- defines how will the messages be transmitted on the wire --> </ binding > < service > <!-- defines location of web service --> </ service > </ definitions > Example : WSDL
  15. 15. <ul><li>Import: Import the definitions from a specified namespace in another WSDL document into the current WSDL document </li></ul><ul><ul><li>namespace attribute, which value must match that of the namespace declared in the imported WSDL document. must not be a relative URI </li></ul></ul><ul><ul><li>location attribute, which cannot be empty or null, that must point to an actual WSDL document.
  16. 16. targetNamespace attribute in an imported WSDL document's <definitions> element must be the same as the value of the namespace attribute in the WSDL <import> element importing the WSDL document. </li></ul></ul>Definitions – Import
  17. 17. <ul><li>Definitions : It defines the name of the web service, declares multiple namespaces used throughout the remainder of the document. </li><ul><li>Root of the wsdl document
  18. 18. Declares multiples namespaces </li></ul></ul><ul><ul><ul><li>Types : Contains XML schema and type definitions </li></ul></ul></ul><ul><ul><ul><ul><li>Xsd:schema </li><ul><li>Defines types in this namespaces or from other namespaces
  19. 19. Validates the particular wire format
  20. 20. Must be namaspeces defines in the targetnamespace or xsd:schema element or namespace in xsd:import
  21. 21. No extends or restrict array type and convenction ArrayOf </li></ul></ul></ul></ul><li>Messages : Consists of either a number of named part s typed by XML Schema elements, or a single part typed by a XML Schema type </li><ul><li>One-way : single message request or single message response
  22. 22. Part message : parameter input/output </li></ul><li>Port-type : describing a set of operations </li><ul><li>One-way : only request to web service </li></ul></ul><ul><ul><li>Request-response : The operation can receive a request and will return a response.
  23. 23. Solicit-response : The operation can send a request and will wait for a response.
  24. 24. Notification : The operation can send a message but will not wait for a response. </li></ul></ul>Definitions – Messages - Port-type
  25. 25. 1. Definitions  : <definitions .... > <types> <xsd:schema .... />* </types> </definitions> 2. Definitions  : <xsd:element name=&quot;MyArray1&quot; type=&quot;tns:MyArray1Type&quot;/> <xsd:complexType name=&quot;MyArray1Type&quot;> <xsd:sequence> <xsd:element name=&quot;x&quot; type=&quot;xsd:string&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;unbounded&quot;/> </xsd:sequence> </xsd:complexType> Example : Definitions
  26. 26. 1. Message  : <message name=&quot;OrderMsg&quot;> <part name=&quot;productName&quot; type=&quot;xs:string&quot;/> <part name=&quot;quantity&quot; type=&quot;xs:integer&quot;/> </message> 2. Message : type -> RPC <message name=&quot;GetBulkBookPriceRequest&quot;> <part name=&quot;isbn&quot; type=&quot;xsd:string&quot;/> <part name=&quot;quantity&quot; type=&quot;xsd:int&quot;/> </message> 3. Message : element -> Document <message name=&quot;SubmitPurchaseOrderMessage&quot;> <part name=&quot;order&quot; element=&quot;sd:purchaseOrder&quot; /> </message> 4. Message : fault <message name=&quot;InvalidArgumentFault&quot;> <part name=&quot;error_message&quot; element=&quot;sd:InvalidIsbnFaultDetail&quot; /> </message> Example : Message
  27. 27. 1. Port-type : one-way <wsdl:definitions .... > <wsdl:portType .... > * <wsdl:operation name=&quot;nmtoken&quot;> <wsdl:input name=&quot;nmtoken&quot;? message=&quot;qname&quot;/> </wsdl:operation> </wsdl:portType > </wsdl:definitions> 2. Port-type : request - response <wsdl:definitions .... > <wsdl:portType .... > * <wsdl:operation name=&quot;nmtoken&quot; parameterOrder=&quot;nmtokens&quot;> <wsdl:input name=&quot;nmtoken&quot;? message=&quot;qname&quot;/> <wsdl:output name=&quot;nmtoken&quot;? message=&quot;qname&quot;/> <wsdl:fault name=&quot;nmtoken&quot; message=&quot;qname&quot;/>* </wsdl:operation> </wsdl:portType > </wsdl:definitions> Example : Port-type
  28. 28. 3. Port-type : solicit-response <wsdl:definitions .... > <wsdl:portType .... > * <wsdl:operation name=&quot;nmtoken&quot; parameterOrder=&quot;nmtokens&quot;> <wsdl:output name=&quot;nmtoken&quot;? message=&quot;qname&quot;/> <wsdl:input name=&quot;nmtoken&quot;? message=&quot;qname&quot;/> <wsdl:fault name=&quot;nmtoken&quot; message=&quot;qname&quot;/>* </wsdl:operation> </wsdl:portType > </wsdl:definitions> 4. Port-type : notification <wsdl:definitions .... > <wsdl:portType .... > * <wsdl:operation name=&quot;nmtoken&quot; parameterOrder=&quot;nmtokens&quot;> <wsdl:output name=&quot;nmtoken&quot;? message=&quot;qname&quot;/> </wsdl:operation> </wsdl:portType > </wsdl:definitions> Example : Port-type
  29. 29. <ul><li>Bindings: Selects communication protocol and data formats for each operation and message . The binding element describes the concrete specifics of how the service will be implemented on the wire </li></ul><ul><ul><li>Transport must be &quot; http://schemas.xmlsoap.org/soap/http “.
  30. 30. Style must be either a RPC/Literal binding or a Document/Literal binding
  31. 31. location attribute in a <soapbind:address> element must be unique within a WSDL document
  32. 32. HTTP response from a web service operation using the one-way message exchange pattern must have an empty body
  33. 33. client of a web service operation using the one-way message exchange pattern must ignore any SOAP messages returned. Such a response just indicates that the message has reached the receiver
  34. 34. One or more WSDL documents may contain more than one WSDL <binding> elements that refer to one and the same WSDL <portType> element
  35. 35. WSDL document must have the same set of operations as the WSDL <portType> element to which the binding refers
  36. 36. SOAP message that is inconsistent with its WSDL document, it must check for “VersionMismatch”, “MustUnderstand” and “Client” fault conditions in that order. </li></ul></ul>Binding
  37. 37. <ul><li>Document/Literal binding have at most one part listed in the parts attribute , if the parts attribute is specified </li><ul><li>may, in its <soapbind:body> element(s), only refer to WSDL <part> elements that has been defined using the element attribute .
  38. 38. parts attribute with the value “” , the corresponding envelope must have an empty SOAP <Body> element </li></ul><li>A RPC/Literal </li><ul><li>in its <soapbind:body> element(s), only refer to WSDL <part> elements that has been defined using the type attribute
  39. 39. must contain exactly one par t accessor element for each of the WSDL <part> elements bound to the envelope's corresponding <soapbind:body> element
  40. 40. has a parts attribute with the value “” (the empty string), the corresponding envelope must have no part accessor elements. </li></ul></ul><ul><ul><li>RPC : <soapbind:body> element has a use attribute with the value “literal” </li><ul><li><operation> element has a <soapbind:operation> child element with the style attribute having the value “rpc </li></ul><li>Document : <soapbind:body> element has a use attrib. with the value “literal” </li><ul><li><operation> element has a <soapbind:operation> child element with the style attribute having the value “document </li></ul><li>Same lists of operation between port-type and operation </li></ul></ul>Binding
  41. 41. Example : Binding
  42. 42. Example : Binding Header
  43. 43. <ul><li>Service  : Describes a collection of named port s, each associated with a binding and a network address. The service element defines the address for invoking the specified service. </li><ul><li>One-way : single message request or single message response
  44. 44. Part message : parameter input/output </li></ul><li>Port-type : describing a set of operations. WSDL Can have one or more <portType> elements, each defining an interface of a different web service. RPC or Document. </li><ul><li><operation> in a <portType> corresponds to a method in the interface of the web service.
  45. 45. at most one <input> and at most one <output> element and any number of <fault> elements. </li></ul></ul><ul><ul><li>One-way : only request to web service. May not declare any <fault> elements
  46. 46. Request-response : input message and web services respond with an output message. May additionally declare zero or more <fault> elements </li></ul></ul><ul><ul><li>Solicit-response : endpoint send an output message and then receives an input message
  47. 47. Notification : endpoint send an output message </li></ul></ul>Service - Port-type
  48. 48. <portType name=&quot;StockQuotePortType&quot;> <operation name=&quot; GetLastTradePrice &quot;> <input message=&quot;tns:GetLastTradePriceInput&quot;/> <output message=&quot;tns:GetLastTradePriceOutput&quot;/> </operation> </portType> Example : Port-type
  49. 49. <service name=&quot;StockQuoteService&quot;> <documentation>My first service</documentation> <port name=&quot;StockQuotePort&quot; binding=&quot;tns:StockQuoteBinding&quot;> <soap:address location=&quot;http://example.com/stockquote&quot;/> </port> </service> Example : Service

×