1 / 38

WSDL-Web Service Description Language

WSDL-Web Service Description Language. By Shin Chuan , Lin July / 8 /2003. Topic Covered. Introduction Structure of WSDL document Example of WSDL Difference between WSDL 1.2 and WSDL 1.1 How to use WSDL file ? Reference. Introduction. What is WSDL ?

Download Presentation

WSDL-Web Service Description 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 Description Language By Shin Chuan , Lin July / 8 /2003

  2. Topic Covered • Introduction • Structure of WSDL document • Example of WSDL • Difference between WSDL 1.2 and WSDL 1.1 • How to use WSDL file ? • Reference

  3. Introduction • What is WSDL ? Stands for Web Service Description Language It’s an XML document for describing web services Further considers that an interface represents the behavior of a resource on the World Wide Web • What can we know from WSDL ? What kind of message is exchanged ? How are the message related ?(e.q operation input or output) How SOAP messages are exchanged ?

  4. What is WSDL ?

  5. Structure of WSDL document • Type • Messages • interfaces(Port Types)WSDL1.2 • Bindings Protocol – html , smtp Encoding • Service “Interface” definition “endpoint” definition

  6. Structure of WSDL document <definitions> <types>definition of types</types> <message>definition of message</message> <interface>definition of interface</interface> <binding>definition of biding</binding> <services>definition of endpoint </endpoint> </definitions>

  7. Structure of WSDL document :definitions • Definitions Component is just a container for two categories of component: (1)WSDL Component: messages, interface , binding and services (2)Type System Component: element declartions and type definitions drawn from some type system . • Definitions are represented in XML by one or more WSDL information Sets(Infosets). A WSDL InfoSet contains representations of a collection of WSDL components which share a common target namespace.

  8. Structure of WSDL document :Types • The types element encloses data type definitions that are relevant for the exchanged messages. WSDL prefers the use of XML Schema . • FROM <type> <xsd:schema …/> </type>

  9. An Example of WSDL Types <tpyes> <schema targetNamespace = “http://examploe.com/stockquote.xsd”> <element name=“TradePrice”> <all> <element name=“price” type=“float”/> </all> </complex Type> </element> </schema> </type> Note: (1) Use element form (2) Array types should extend the Array type from SOAP v1.1 encoding schema ( http://schemas.xmlsoap.org/soap/encoding)

  10. Structure of WSDL document :Message • The message component describes the abstract format of a particular message that Web service sends or receives . • Combine with binding to describe how the abstract content is mapped into a concrete format . • From: <messages name = “”> <target namespace> <part name = “” element= “” type =“”?/> … <message>

  11. An Example of WSDL Message <message name=“InputParameters”> <partname = “firstname” type=“xsd:string”/> <part name = “age” type=“xsd:int”/> </message> <message name=“OutputParameters”> <part name=“id” type=“xsd:int”/> </message> What does this mean ? Int get_id(string firstname , int age)

  12. An Example of WSDL Message name : local name of message part component : describes a portion of a particular message that a web service sends or receives . type : describe the format of a part element : carrier information about its type system

  13. Structure of WSDL document :interface • The interface element is core WSDL element . It describes a set of messages that a service sends and/or receives , by grouping related messages into operations. • Operations include : One-way transmission The endpoint receives a message Request-response The endpoint receives a message and sends a correlated message Solicit-Response The endpoint sends a message and receives correlated message . Notification The endpoint sends a messge

  14. Structure of WSDL document :interface • Form: <definitions> <interface> <operation name =“xs:NCNAME” pattern=“xs:anyURI” <documentation/>? [ <feature/> | <property/> | [<input/> | <output/> | <infault /> | <outfault/>]+ ]* </operation> </interface> </definitions>

  15. Structure of WSDL document :interface(cont1) Operation : An interface operation component describes an operation that a given interface supports. An operation is a set of message references and an associated message pattern. Message references are references either to messages accepted by this operation(input message) ,or messages send by this operation(output messages) . Such messages could be ordinary messages or fault messages . fault element specify the abstract message format for any error messages that may be output as the result of the operation

  16. Structure of WSDL document :interface(cont2) {message pattern} A URI identifying the message pattern used by the operation. {message references}A set of message reference components for the ordinary messages the operation accepts or send . {fault references}A set of fault reference components for the fault messages the operation accepts or sends. {features} A set of named feature definitions used by the operation {properties} A set of named property definitions used by the operation.

  17. Example of interface <interface name="TicketAgent"> <operation name="listFlights“ parameterOrder="depart origin destination"> <input message= "tns:listFlightsRequest" name= "listFlightsRequest"/> <output message= "tns:listFlightsResponse“ name= "listFlightsResponse"/> </operation>

  18. Example of interface(cont1) <operation name = "reserveFlight“ parameterOrder= "depart origin destination flight"> <input message= "tns:reserveFlightRequest“ name= "reserveFlightRequest"/> <output message= "tns:reserveFlightResponse“ name="reserveFlightResponse"/> </operation> </interface>

  19. Structure of WSDL document :Bindings • A binding defines message format and protocol details for operations and messages defined by a particular interface . • WSDL (Version 1.2):Bindings [WSDL 1.2 Bindings] defines such bindings for SOAP 1.1 [SOAP 1.1], SOAP 1.2 [SOAP 1.2 Part 1: Messaging Framework], HTTP [IETF RFC 2616] and MIME [IETF RFC 2045]. Other specifications MAY define additional binding details

  20. Structure of WSDL document :Bindings From <binding name=““ interface=“”> <operation name=“”> <input name=“”?></input> <output name=“”?></output> <fault name=“”></fault> </operation> </binding> Note : A binding MUST specify exactly one protocol

  21. Example of binding <binding name=“Binding1” type=“record”> <soap:binding style=“document” Transport=http://schemas.xmlsoap.org/soap/http/> <operation name=“get_id”> <soap:operation soapAction =“http://example.com/get_id”> <input> <soap:body use =“literal”/> </input> <output> <soap:body use=“literal”/> </output> </operation> </binding>

  22. Structure of WSDL document :Service • A service component describes one and only one interface that a service provides, and the endpoints it is provided over.

  23. Structure of WSDL document :Service Forms: <definitions> <service name= "xs:NCName" interface="xs:QName" targetResource="xs:anyURI"? > <documentation />? <endpoint />* </service> </definitions>

  24. Structure of WSDL document :Service • An endpoint component defines the particulars of a specific end-point at which a given service is available. The properties of the Endpoint Component are as follows: • {name} An NCName as defined by [XML Namespaces]. • {binding} A named binding component For each endpoint component in the {endpoints} property of a service component the {name} property must be unique.

  25. Example of WSDLSOAP binding of one-way operation over SMTP using a SOAP Header <?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://schemas.xmlsoap.org/wsdl/soap/ xmlns="http://schemas.xmlsoap.org/wsdl/">

  26. Example of WSDLSOAP binding of one-way operation over SMTP using a SOAP Header <message name="SubscribeToQuotes"> <part name="body“ element="xsd1:SubscribeToQuotes"/> <part name="subscribeheader“ element="xsd1:SubscriptionHeader"/> </message>

  27. Example of WSDLSOAP binding of one-way operation over SMTP using a SOAP Header <interface name="StockQuoteInterface"> <operation name="SubscribeToQuotes"> <input message="tns:SubscribeToQuotes"/> </operation> </interface>

  28. Example of WSDLSOAP binding of one-way operation over SMTP using a SOAP Header <binding name="StockQuoteSoap“ type="tns:StockQuoteInterface"> <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>

  29. Example of WSDLSOAP binding of one-way operation over SMTP using a SOAP Header <service name="StockQuoteService"> <endpoints name="StockQuoteEndpoint“ binding="tns:StockQuoteSoap"> <soap:address location="mailto:subscribe@example.com"/> </endpoints> </service>

  30. Example of WSDLSOAP binding of one-way operation over SMTP using a SOAP Header <types> <schema targetNamespace=http://example.com/stockquote.xsd xmlns="http://www.w3.org/2000/10/XMLSchema"> <element name="SubscribeToQuotes"> <complexType><all> <element name="tickerSymbol" type="string"/> </all></complexType></element> <element name="SubscriptionHeader" type="uriReference"/> </schema></types> </definitions>

  31. What does it mean? • In the above example , a SubscribeToQuotes SOAP 1.1 one-way message is sent to a StockQuote service via a SMTP binding. The request takes a ticker symbol of type string, and includes a header defining the subscription URI.

  32. Difference between WSDL1.2 and WSDL1.1 • Operation Overloading WSDL 1.1 supported operation overloading and WSDL 1.2 removes it. This section will provide some rationale for it and provide hints on how to work around some scenarios. • PortTypes Port types have been renamed to interfaces. We now have interface inheritance. • Ports Ports have been renamed to endpoints.

  33. Conclusion(How to use wsdl?) • EX: How to use Google API with WSDL ? • Google provide standard wsdl file • http://api.google.com/GoogleSearch.wsdl • How to use wsdl file? Many programming languages now understand WSDL and can use this file to automatically invoke Google's API. For example, the WSDL can be imported into .NET, converted into Java code using Apache Axis WSDL2Java, or used directly by Perl SOAP::Lite. The WSDL file has been tested with SOAP::Lite 0.52, the .NET Framework, (via "Add Web Reference" or wsdl.exe version 1.0.3705.0), and Apache Axis Beta 1.

  34. How to use wsdl? Use Google with Perl Example : use SOAP::Lite; my $key='000000000000000000000000'; my $query="foo"; my $googleSearch = SOAP::Lite -> service("file:GoogleSearch.wsdl"); my $result = $googleSearch -> doGoogleSearch($key, $query, 0, 10, "false", "", "false", "", "latin1", "latin1"); print "About $result->{'estimatedTotalResultsCount'} results.\n";

  35. How to use wsdl? • What is SOAP::Lite ? • SOAP::Lite makes the request for service description, parses it, builds the stub (object that make available the same methods as remote service) and returns it to you.

  36. How to use wsdl? Example : #!perl -w use SOAP::Lite; my $service = SOAP::Lite -> service(‘http://api.google.com/GoogleSearch.wsdl'); print ‘ReturnByMSFT + ReturnByORCL = ', $service->getQuote(‘ReturnByMSFT') + $service->getQuote(‘ReturnByORCL');

  37. How to use wsdl? • You may also use your local computer with multiple wsdl file .. • Example : #!perl -w use SOAP::Lite service =>’http://api.google.com/GoogleSearch.wsdl ', #service=>'file:/your/local/path/GoogleLocal.wsdl‘ , # service => 'file:./yourOwnService.wsdl', ; print getQuote(‘RetrunByMSFT'), "\n"; More Detail please check : http://www.soaplite.com/

  38. References Web Services Description Language (WSDL) 1.1 W3C Note 15 March 2001 : [http://www.w3.org/TR/2001/NOTE-wsdl-20010315 ] Web Services Description Language (WSDL) Version 1.2 Part 1: Core Language W3C Working Draft 11 June 2003 [http://www.w3.org/TR/2003/WD-wsdl12-20030611 ] Web service : [http://ru.sun.com/win/developers/std02/presentations/ritter3.pdf] WSDL overview: [http://www.intl-interfaces.com/servicemodel/WSDLOverview1.pdf] Web Service Web Service Description Language [www.ti5.tu-harburg.de/Lecture/03ss/SEM/030505/ 030505MariuszChechelski_slides.pdf] SOAP::LiteforPerl [http://www.soaplite.com/ ] Google API package readme.txt [http://www.google.com/apis/download.html]

More Related