1 / 29

WSDL : Web Service Definition Language

WSDL : Web Service Definition Language. Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic. WSDL: describe a web services. Initialized by IBM, Microsoft, Ariba and 6~ other companies 2004.8: w3c releases WSDL 2.0. Interoperability Using WSDL. Service. Client. HTTP. WSDL description.

adli
Download Presentation

WSDL : Web Service Definition Language

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. WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic

  2. WSDL: describe a web services • Initialized by IBM, Microsoft, Ariba and 6~ other companies • 2004.8: w3c releases WSDL 2.0

  3. Interoperability Using WSDL Service Client HTTP WSDL description Get WSDL doc Invoke Service SOAP Service J2EE Container Service Objects

  4. WSDL: Describe a web service • 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 services

  5. WSDL: • A contract between requestor and provider • Platform and language-independent • Describe SOAP services • Automatic tool to generate client and sever code

  6. What do we learn? • WSDL specification • Generate WSDL for a service (from java objects to WSDL) • Generate java classes from WSDL • Other ways for distributed system: rmi, and CORBA

  7. An example of WSDL: HelloWorld Root element, defines namespaces <wsdl:definitions targetNamespace="http://localhost:8080/axis/services/urn:HelloWorld" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://localhost:8080/axis/services/urn:HelloWorld" xmlns:intf="http://localhost:8080/axis/services/urn:HelloWorld" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="http://www.w3.org/1999/XMLSchema" xmlns:tns2="http://www.w3.org/2003/05/soap-encoding" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> Convention, refer to itself (?) WSDL uses it to generate package name WSDL schema WSDL-SOAP binding xmlschema

  8. <Service> Where is the service located? <wsdl:service name="HelloWorldServiceService"> <wsdl:port binding="impl:urn:HelloWorldSoapBinding" name="urn:HelloWorld"> <wsdlsoap:address location="http://localhost:8080/axis/services/urn:HelloWorld" />   </wsdl:port> </wsdl:service> The service location: the endpoint of the SOAP message

  9. <Binding> Bind messages to operations Use SOAP HTTP protocol <wsdl:binding name="urn:HelloWorldSoapBinding" type="impl:HelloWorldService">   <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" /> - <wsdl:operation name="sayHello">   <wsdlsoap:operation soapAction="" /> - <wsdl:input name="sayHelloRequest">   <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://HelloWorld.samples" use="encoded" />   </wsdl:input> - <wsdl:output name="sayHelloResponse">   <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/axis/services/urn:HelloWorld" use="encoded" />   </wsdl:output>   </wsdl:operation> -  </wsdl:binding>

  10. <portType> Bind messages to operations Operation: sayHello <wsdl:portType name="HelloWorldService"> - <wsdl:operation name="sayHello" parameterOrder="in0 in1">   <wsdl:input message="impl:sayHelloRequest" name="sayHelloRequest" />   <wsdl:output message="impl:sayHelloResponse" name="sayHelloResponse" />   </wsdl:operation> </wsdl:portType> Input Message: sayHelloRequest Output Message: sayHelloResponse

  11. <message> Define message: sayHelloRequest Content of message Parameter 1, type string <wsdl:message name="sayHelloRequest">   <wsdl:part name="in0" type="tns2:string" />   <wsdl:part name="in1" type="tns2:string" />   </wsdl:message> <wsdl:message name="sayHelloResponse">   <wsdl:part name="sayHelloReturn" type="tns2:string" />   </wsdl:message> Parameter 2, type string Define massage: sayHelloResponse Parameter 1, type string

  12. Structure of WSDL <definitions>:Root WSDL Element <types>:What data types will be transmitted? <message>:What message will be transmitted? <portType>:What operations (functions) will be supported? <binding>:How will the messages be transmitted on the wire? What SOAP-specific details are there? <service>:Where is the service located? P121 fig 6-1

  13. Definition: <wsdl:definitions> • Root element • Name of the web service • Declare multiple namespaces

  14. Complex data types: <types> • Not used if limit to XML schema • Define complex types (correspondent to a class in java)

  15. Message definitions: <message> • A request message or a response message • Name of the message • Element <part> defines the data types used in the message • Types of the parameters for the request message • Types of the return values for the response message

  16. Operation definitions: <portType> • Operations: the remote methods • Input/output messages for operations <wsdl:portType name="HelloWorldService"> - <wsdl:operation name="sayHello" parameterOrder="in0 in1">   <wsdl:input message="impl:sayHelloRequest" name="sayHelloRequest" />   <wsdl:output message="impl:sayHelloResponse" name="sayHelloResponse" />   </wsdl:operation> </wsdl:portType>

  17. Operation patterns supported by WSDL 1.1 One-way <input> Client Service Request-response <input> 1 Client Service <output> 2 Solicit-response <output> 1 Client Service <input> 2 Notification Client <output> Service P126. fig 6-3

  18. Basic patterns of operation • One-way: • The service receives a message. • The operation therefore has a single input element • Request-response: • The service receives a message and sends a response • One input element, one output element

  19. Basic patterns of operation (2) • Solicit-response • The service sends a message and receives a response • The operation has one output message, followed by one input message • Notification • The service sends a message. • The operation has one output message

  20. Transmission protocols: <binding> • Binding transmission protocols to operations • Axis: http

  21. Service location: <service> • SOAP endpoint of the web service

  22. Second example: WSDL of StockQuote • Deploy the sample StockQuoteService • The WSDL is at http://localhost:8080/axis/services/urn:xmltoday-delayed-quotes?wsdl

  23. Messages <wsdl:message name="getQuoteRequest">   <wsdl:part name="symbol" type="tns2:string" /> </wsdl:message> <wsdl:message name="getQuoteResponse">   <wsdl:part name="getQuoteReturn" type="xsd:float" />   </wsdl:message>

  24. Operations <wsdl:portType name="StockQuoteService"> - <wsdl:operation name="getQuote" parameterOrder="symbol">   <wsdl:input message="impl:getQuoteRequest" name="getQuoteRequest" />   <wsdl:output message="impl:getQuoteResponse" name="getQuoteResponse" />   </wsdl:operation> </wsdl:portType>

  25. Binding <wsdl:binding name="GetQuoteSoapBinding" type="impl:StockQuoteService">   <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="getQuote">   <wsdlsoap:operation soapAction="" /> - <wsdl:input name="getQuoteRequest">   <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://stock.samples" use="encoded" />   </wsdl:input> - <wsdl:output name="getQuoteResponse">   <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/axis/services/urn:xmltoday-delayed-quotes" use="encoded" />   </wsdl:output>   </wsdl:operation>   </wsdl:binding>

  26. Service location <wsdl:service name="StockQuoteServiceService"> - <wsdl:port binding="impl:GetQuoteSoapBinding" name="GetQuote">   <wsdlsoap:address location="http://localhost:8080/axis/services/urn:xmltoday-delayed-quotes" />   </wsdl:port>   </wsdl:service>

  27. WSDL Summary <definitions>:The StockQuoteService • <message>: • getQuoteRequest: parameter:symbol; type: string • getQuoteResponse: return float <portType>:getQuote operation that consists of a request/response service <binding>:Direction to use the SOAP HTTP transport protocol. <service>:Service available at: localhost:8080/axis/services/urn:xmltoday-delayed-quotes

  28. Using WSDL with Axis • Obtaining WSDL for deployed services • WSDL2Java: Building stubs, skeletons, and data • Java2WSDL: Building WSDL from Java

  29. Obtain WSDL for deployed services • Axis generates WSDL for any deployed services • In the service list, check the WSDL files

More Related