1 / 18

Web Services: WSDL

Web Services: WSDL. Kas ir WSDL ?. Pirms izmantot SOAP ar konkrēto servisu ir jāzina kādai jābūt SOAP ziņojuma struktūrai kuru protokolu izmantot (HTTP, SMTP u.c. ) kāda ir web servisa Internet adrese

erv
Télécharger la présentation

Web Services: WSDL

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Web Services: WSDL

  2. Kas ir WSDL? • Pirms izmantot SOAP ar konkrēto servisu ir jāzina • kādai jābūt SOAP ziņojuma struktūrai • kuru protokolu izmantot (HTTP, SMTP u.c.) • kāda ir web servisa Internet adrese • WSDL (Web Services Description Language) ir XML tipa valoda, kas apraksta Web servisus un to kā tiem piekļūt • WSDL 1.1 – 2001.gada 15.marts • WSDL 2.0 –2007.gada 26.jūnijs

  3. Ko WSDL definē? • WSDL describes four critical pieces of data • Interface information describing all publicly available functions • Data type information for all message requests and message responses • Binding information about the transport protocol to be used • Address information for locating the specified service • WSDL represents a contract between the service requestor and the service provider

  4. WSDL Code Generation • WSDL is well suited for code generators, which can read a WSDL document and generate a programmatic interface for accessing a Web service

  5. WSDL 1.1 Specification • The full specification is divided into six major elements • definitions • types • message • portType • binding • service

  6. The definitions Element • Root element of all WSDL documents • Defines the name of the web service • Declares multiple namespaces used throughout the document • Contains all other the service elements <definitions name="BookQuoteWS" targetNamespace="http://www.Monson-Haefel.com/jws/BookQuote" xmlns:mh="http://www.Monson-Haefel.com/jws/BookQuote" xmlns:soapbind="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/"> . . . . . . </definitions>

  7. The types Element • Describes all the data types used between the client and server • Uses the XML schema language to declare complex data types and elements • WSDL adopts, as its basic type system, the W3C XML schema built-in types • If the service uses only W3C XML Schema built-in simple types, such as strings and integers, the types element is not required

  8. Example: types element <types> <xsd:schema targetNamespace="http://www.Monson-Haefel.com/jwsbook/BookQuote"> <xsd:simpleType name="ISBN"> <xsd:restriction base="xsd:string"> <xsd:pattern value="[0-9]{9}[0-9Xx]" /> </xsd:restriction> </xsd:simpleType> </xsd:schema> </types>

  9. The message Element • Describes a one-way message, whether it is a single message request or a single message response • Defines the name of the message • Contains zero or more message part elements, which can refer to message parameters or message return values

  10. Example: message element <definitions name="BookPrice" ...> ... <message name="GetBookPriceRequest"> <part name="isbn" type="xsd:string" /> </message> <message name="GetBookPriceResponse"> <part name="price" type="xsd:float" /> </message> ... </definitions>

  11. The portTypeElement • Combines multiple message elements to form a complete one-way or round-trip operation • Defines the abstract interface of a Web service <portType name="BookQuote"> <operation name="getBookPrice"> <input name="isbn" message="mh:GetBookPriceRequest"/> <output name="price" message="mh:GetBookPriceResponse"/> </operation> </portType>

  12. Messaging Exchange Patterns • There are four basic message exchange patternsused in Web services • Request/Response • The service receives a message • One-Way • The service receives a message and sends a response • Notification • The service sends a message • Solicit/Response • The service sends a message and receives a response

  13. The bindingElement • Describes the concrete specifics of how the service will be implemented on the wire • Maps an abstract portType to a set of concrete • protocols such as SOAP and HTTP • messaging styles (RPC or document) • encoding styles (Literal or SOAP Encoding)

  14. Example: binding element <binding name="BookPrice_Binding" type="mh:BookQuote"> <soapbind:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="getBookPrice"> <soapbind:operation style="rpc" soapAction="http://… /BookQuote/GetBookPrice"/> <input> <soapbind:body use="literal" namespace="http://…/BookQuote" /> </input> <output> <soapbind:body use="literal" namespace="http://…/BookQuote" /> </output> </operation> </binding>

  15. The serviceElement • Specifies the location of the service • Contains one or more port elements, each of which represents a different Web service • The port element assigns the URL to a specific binding <service name="BookPriceService"> <port name="BookPrice_Port" binding="mh:BookPrice_Binding"> <soapbind:address location= "http://www.Monson-Haefel.com/jwsbook/BookQuote" /> </port> </service>

  16. WSDL 2.0 • Now there are 3 separate specifications • Part 1: Core • Abstract interfaces, independent ofprotocol and encoding • Part 2: Message Exchange Patterns • Predefined types of interactions • Part 3: Bindings • SOAP and HTTP/MIME binding

  17. Summary • WSDL provides a precise, structured, and standard format for describing Web services • Code generators can create convenient language-specific call interfaces for invoking Web services • So, in many cases you will not deal directly with WSDL documents • You have to understand WSDL to construct and exchange SOAP messages properly when using SOAP APIs

  18. References • WSDL Essentials http://www.oreilly.com/catalog/webservess/chapter/ch06.html • WSDL Version 2.0 Part 0: Primer http://www.w3.org/2002/ws/desc/wsdl20-primer • Google Search WSDL example http://api.google.com/GoogleSearch.wsdl

More Related