introduction to the web services description language...
TRANSCRIPT
![Page 1: Introduction to the Web Services Description Language …haim/teaching/iws/resources/Presentations/2002...1 Introduction to the Web Services Description Language (WSDL) Presented by](https://reader031.vdocuments.site/reader031/viewer/2022022011/5b0b5e2a7f8b9a45518de196/html5/thumbnails/1.jpg)
1
Introduction to the Web Introduction to the Web Services Description Services Description Language (WSDL)Language (WSDL)
Presented by Paul Kingston
AgendaAgenda
l Definition of WSDL.l Web services overview and where WSDL fits.l Dissection of the WSDL Protocol.l Demos
– Generation of code from WSDL.– Generation of WSDL from code.
l Tools that support WSDL, and other resources.l References.
![Page 2: Introduction to the Web Services Description Language …haim/teaching/iws/resources/Presentations/2002...1 Introduction to the Web Services Description Language (WSDL) Presented by](https://reader031.vdocuments.site/reader031/viewer/2022022011/5b0b5e2a7f8b9a45518de196/html5/thumbnails/2.jpg)
2
Definitions of WSDLDefinitions of WSDL(taken from the specification)(taken from the specification)
l "A set of definitions". l "An XML format for describing network
services as a set of endpoints operating on messages containing either document oriented or procedure oriented information".
WSDL IS XMLWSDL IS XML
l However it is assumed that the audience know enough XML to follow along.
![Page 3: Introduction to the Web Services Description Language …haim/teaching/iws/resources/Presentations/2002...1 Introduction to the Web Services Description Language (WSDL) Presented by](https://reader031.vdocuments.site/reader031/viewer/2022022011/5b0b5e2a7f8b9a45518de196/html5/thumbnails/3.jpg)
3
Web Services ModelWeb Services Model
Service Provider
Service RegistryService Requestor
Bind
Find
Publish
WSDL in the Web Services WSDL in the Web Services ModelModel
Service Provider
Service RegistryService Requestor
WSDL + SOAP or HTTP
WSDL + UDDI
UDDI
![Page 4: Introduction to the Web Services Description Language …haim/teaching/iws/resources/Presentations/2002...1 Introduction to the Web Services Description Language (WSDL) Presented by](https://reader031.vdocuments.site/reader031/viewer/2022022011/5b0b5e2a7f8b9a45518de196/html5/thumbnails/4.jpg)
4
WSDL Protocol WSDL Protocol –– the what, the what, how and wherehow and where
Every WSDL file can be thought of as consisting of three basic parts:
l “what” – the operations and messages.l “how” – communications mechanism.l “where” – location of the service.
WSDL Protocol WSDL Protocol –– the whatthe what
The <types>, <message> and <portType> tags indicate the operations and what type of data will be passed.
![Page 5: Introduction to the Web Services Description Language …haim/teaching/iws/resources/Presentations/2002...1 Introduction to the Web Services Description Language (WSDL) Presented by](https://reader031.vdocuments.site/reader031/viewer/2022022011/5b0b5e2a7f8b9a45518de196/html5/thumbnails/5.jpg)
5
WSDL Protocol WSDL Protocol –– the howthe how
<binding> tags indicate the what sort of transport mechanism (protocol) the service will use to communicate.
WSDL Protocol WSDL Protocol –– the wherethe where
<service> tags indicate the location of the service
![Page 6: Introduction to the Web Services Description Language …haim/teaching/iws/resources/Presentations/2002...1 Introduction to the Web Services Description Language (WSDL) Presented by](https://reader031.vdocuments.site/reader031/viewer/2022022011/5b0b5e2a7f8b9a45518de196/html5/thumbnails/6.jpg)
6
WSDL Protocol WSDL Protocol –– the basicsthe basics
l All elements are set within the <definition> root element.
l The <import> element allows partitioning of a WSDL file into smaller files based on functionality.
l Extensibility elements allow for WSDL additions without rewriting the specification.
A shell WSDL file:A shell WSDL file:
<?xml version="1.0"?><definitions>
<types></types>
<message></message>
<portType></portType>
<binding></binding>
<service></service>
</definitions>
l The component elements can be thought of as "building on each other" as elements towards the bottom reference elements at the top.
l All elements can have child <documentation> elements which are used as comments.
![Page 7: Introduction to the Web Services Description Language …haim/teaching/iws/resources/Presentations/2002...1 Introduction to the Web Services Description Language (WSDL) Presented by](https://reader031.vdocuments.site/reader031/viewer/2022022011/5b0b5e2a7f8b9a45518de196/html5/thumbnails/7.jpg)
7
<definitions> element<definitions> element<definitions
name=""(optional) targetNamespace=""(optional)
xmlns:""="" (optional - one or more) ></definitions>
l All elements have name scope (i.e. all names must be unique).
l Can also use the <import> element to import or associate a namespace with the WSDL document.
Let's assemble the <definitions> Let's assemble the <definitions> element for the example:element for the example:
<definitions
name="CurrencyExchangeService"targetNamespace="http://www.xmethods.net/sd/CurrencyExchangeService.wsdl" xmlns:tns="http://www.xmethods.net/sd/CurrencyExchangeService.wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/">
![Page 8: Introduction to the Web Services Description Language …haim/teaching/iws/resources/Presentations/2002...1 Introduction to the Web Services Description Language (WSDL) Presented by](https://reader031.vdocuments.site/reader031/viewer/2022022011/5b0b5e2a7f8b9a45518de196/html5/thumbnails/8.jpg)
8
Which gives us so far:Which gives us so far:<definitions
name="CurrencyExchangeService"targetNamespace="http://www.xmethods.net/sd/CurrencyExchangeService.wsdl"
xmlns:tns="http://www.xmethods.net/sd/CurrencyExchangeService.ws dl" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types></types><message></message><portType></portType><binding></binding><service></service>
</definitions>
<types> element<types> element<types>
<schema targetNamespace="" xmlns=""><element> (optional, one or more)
<complexType><all>
<element name="" type=""/> (one or more)</all>
</complexType></element>
</schema></types>
![Page 9: Introduction to the Web Services Description Language …haim/teaching/iws/resources/Presentations/2002...1 Introduction to the Web Services Description Language (WSDL) Presented by](https://reader031.vdocuments.site/reader031/viewer/2022022011/5b0b5e2a7f8b9a45518de196/html5/thumbnails/9.jpg)
9
<types> element (cont.)<types> element (cont.)
l Define data types which will be used in exchanged messages.
l XSD is the "preferred" type system.l The <element> tags can be used to define
composite data types (structures).l Not necessary if only using primitive data types
defined by the schema namespace.l Since our example only uses primitive types, it
does not need a <types> element.
XMLSchema typesXMLSchema typesstring
boolean decimal
float double
durationdateTime
time date
gYearMonth gYear
gMonthDay gDay
gMonth hexBinary
base64BinaryanyURI QName
NOTATION
![Page 10: Introduction to the Web Services Description Language …haim/teaching/iws/resources/Presentations/2002...1 Introduction to the Web Services Description Language (WSDL) Presented by](https://reader031.vdocuments.site/reader031/viewer/2022022011/5b0b5e2a7f8b9a45518de196/html5/thumbnails/10.jpg)
10
<message> element<message> element
<message name=""><part name="" element="" (or) type=""/> (optional, one or
more)</message>
l A definition of the data exchanged between endpoints.
Let's assemble the <message> Let's assemble the <message> elements for the exampleelements for the example
<message name="getRateRequest"><part name="country1" type="xsd:string" /> <part name="country2" type="xsd:string" />
</message><message name="getRateResponse">
<part name="Result" type="xsd:float" />
</message>
![Page 11: Introduction to the Web Services Description Language …haim/teaching/iws/resources/Presentations/2002...1 Introduction to the Web Services Description Language (WSDL) Presented by](https://reader031.vdocuments.site/reader031/viewer/2022022011/5b0b5e2a7f8b9a45518de196/html5/thumbnails/11.jpg)
11
Which gives us so far:Which gives us so far:<?xml version="1.0"?><definitions
name="CurrencyExchangeService“targetNamespace="http://www.xmethods.net/sd/CurrencyExchangeService.wsdl"xmlns:tns="http://www.xmethods.net/sd/CurrencyExchangeService.wsdl"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"xmlns="http://schemas.xmlsoap.org/wsdl/"><message name="getRateRequest">
<part name="country1" type="xsd:string" /> <part name="country2" type="xsd:string" />
</message><message name="getRateResponse">
<part name="Result" type="xsd:float" /> </message>…
Which gives us so far (cont):Which gives us so far (cont):
…
<portType></portType><binding>
</binding><service></service>
</definitions>
![Page 12: Introduction to the Web Services Description Language …haim/teaching/iws/resources/Presentations/2002...1 Introduction to the Web Services Description Language (WSDL) Presented by](https://reader031.vdocuments.site/reader031/viewer/2022022011/5b0b5e2a7f8b9a45518de196/html5/thumbnails/12.jpg)
12
<portType> element<portType> element
<portType name=""><operation name=""> (optional, one or more)
<input name=""(optional) message=""> (optional)<output name=""(optional) message=""> (optional)<fault name="" message=""> (optional, one or more)
</operation></portType>
<portType> element (cont.)<portType> element (cont.)
l Defines a set of operations.l Defines input and output to each operation.l portTypes are often referred to as
"endpoints" in the specification.
![Page 13: Introduction to the Web Services Description Language …haim/teaching/iws/resources/Presentations/2002...1 Introduction to the Web Services Description Language (WSDL) Presented by](https://reader031.vdocuments.site/reader031/viewer/2022022011/5b0b5e2a7f8b9a45518de196/html5/thumbnails/13.jpg)
13
Transmission PrimitivesTransmission Primitives
l One-way - the portType receives a message.l Request-response - the portType receives a
message then sends a related message.l Solicit-response - the portType sends a message,
then receives a related message.l Notification - the portType sends a message.
These primitives are referred to as "operations" in WSDL.
Let's assemble the <portType> Let's assemble the <portType> element for the exampleelement for the example
<portType name="CurrencyExchangePortType"><operation name="getRate">
<input message="tns:getRateRequest" /> <output message="tns:getRateResponse" />
</operation></portType>
![Page 14: Introduction to the Web Services Description Language …haim/teaching/iws/resources/Presentations/2002...1 Introduction to the Web Services Description Language (WSDL) Presented by](https://reader031.vdocuments.site/reader031/viewer/2022022011/5b0b5e2a7f8b9a45518de196/html5/thumbnails/14.jpg)
14
Which gives us so far:Which gives us so far:<?xml version="1.0"?><definitions
name="CurrencyExchangeService“targetNamespace="http://www.xmethods.net/sd/CurrencyExchangeService.wsdl"xmlns:tns="http://www.xmethods.net/sd/CurrencyExchangeService.wsdl"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"xmlns="http://schemas.xmlsoap.org/wsdl/"><message name="getRateRequest">
<part name="country1" type="xsd:string" /> <part name="country2" type="xsd:string" />
</message><message name="getRateResponse">
<part name="Result" type="xsd:float" /> </message>…
Which gives us so far (cont):Which gives us so far (cont):
<portType name="CurrencyExchangePortType"><operation name="getRate">
<input message="tns:getRateRequest" /> <output message="tns:getRateResponse" />
</operation></portType>
<binding></binding><service></service>
</definitions>
![Page 15: Introduction to the Web Services Description Language …haim/teaching/iws/resources/Presentations/2002...1 Introduction to the Web Services Description Language (WSDL) Presented by](https://reader031.vdocuments.site/reader031/viewer/2022022011/5b0b5e2a7f8b9a45518de196/html5/thumbnails/15.jpg)
15
<binding> element<binding> elementNote that this element is protocol-specific. <--extensibility element--> denotes
protocol information.
<binding name="" type=""><--extensibility element--> <operation name=""> (optional, one or more)
<input name=""> (optional)<--extensibility element-->
</input><output name=""> (optional)
<--extensibility element--></output><fault name=""> (optional, one or more)
<--extensibility element--></fault>
</operation></binding>
<binding> element (cont.)<binding> element (cont.)
l Defines the protocol and message format for a givenportType.
l The type attribute defines the portType.l The binding specifies exactly one protocol.
![Page 16: Introduction to the Web Services Description Language …haim/teaching/iws/resources/Presentations/2002...1 Introduction to the Web Services Description Language (WSDL) Presented by](https://reader031.vdocuments.site/reader031/viewer/2022022011/5b0b5e2a7f8b9a45518de196/html5/thumbnails/16.jpg)
16
Protocols built into the WSDL Protocols built into the WSDL specificationspecification
l SOAPl HTTP GET & POSTlMIMEl Others can be added at any time, by
anybody using extensibility elements.
Let's assemble the <binding> Let's assemble the <binding> element for the exampleelement for the example
<binding name="CurrencyExchangeBinding" type="tns:CurrencyExchangePortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" /> <operation name="getRate">
<soap:operation soapAction="" /> <input>
<soap:body use="encoded" namespace="urn:xmethods-CurrencyExchange"encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input><output>
<soap:body use="encoded" namespace="urn:xmethods-CurrencyExchange"encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output></operation>
</binding>
![Page 17: Introduction to the Web Services Description Language …haim/teaching/iws/resources/Presentations/2002...1 Introduction to the Web Services Description Language (WSDL) Presented by](https://reader031.vdocuments.site/reader031/viewer/2022022011/5b0b5e2a7f8b9a45518de196/html5/thumbnails/17.jpg)
17
Which gives us so far:Which gives us so far:
<?xml version="1.0"?><definitions
name="CurrencyExchangeService“targetNamespace="http://www.xmethods.net/sd/CurrencyExchangeService.wsdl"xmlns:tns="http://www.xmethods.net/sd/CurrencyExchangeService.wsdl"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"xmlns="http://schemas.xmlsoap.org/wsdl/"><message name="getRateRequest">
<part name="country1" type="xsd:string" /> <part name="country2" type="xsd:string" />
</message><message name="getRateResponse">
<part name="Result" type="xsd:float" /> </message>…
Which gives us so far (cont):Which gives us so far (cont):<portType name="CurrencyExchangePortType">
<operation name="getRate"><input message="tns:getRateRequest" /> <output message="tns:getRateResponse" />
</operation></portType><binding name="CurrencyExchangeBinding" type="tns:CurrencyExchangePortType"><soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" /> <operation name="getRate">
<soap:operation soapAction="" /> <input>
<soap:body use="encoded" namespace="urn:xmethods-CurrencyExchange"encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input><output>
<soap:body use="encoded" namespace="urn:xmethods-CurrencyExchange"encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output></operation>
</binding>…
![Page 18: Introduction to the Web Services Description Language …haim/teaching/iws/resources/Presentations/2002...1 Introduction to the Web Services Description Language (WSDL) Presented by](https://reader031.vdocuments.site/reader031/viewer/2022022011/5b0b5e2a7f8b9a45518de196/html5/thumbnails/18.jpg)
18
Which gives us so far (cont):Which gives us so far (cont):
…<service></service>
</definitions>
<service> element<service> element
Note that like <binding>, this element is protocol-specific. <--extensibility element--> denotes protocol information.
<service name=""><port name="" binding=""> (optional, one or more)
<--extensibility element--></port>
</service>
![Page 19: Introduction to the Web Services Description Language …haim/teaching/iws/resources/Presentations/2002...1 Introduction to the Web Services Description Language (WSDL) Presented by](https://reader031.vdocuments.site/reader031/viewer/2022022011/5b0b5e2a7f8b9a45518de196/html5/thumbnails/19.jpg)
19
<service> element (cont.)<service> element (cont.)
l Defines a collection of ports.l Defines an address from which to access the service.l Each port can specify, at most one address.l Multiple ports can be specified with different addresses
and/or protocols to offer alternatives to client applications.
Let's assemble the <service> Let's assemble the <service> element for the exampleelement for the example
<service name="CurrencyExchangeService">
<documentation>Returns the exchange rate between the two currencies
</documentation> <port name="CurrencyExchangePort"
binding="tns:CurrencyExchangeBinding"><soap:address location="http://services.xmethods.net:80/soap" />
</port>
</service>
![Page 20: Introduction to the Web Services Description Language …haim/teaching/iws/resources/Presentations/2002...1 Introduction to the Web Services Description Language (WSDL) Presented by](https://reader031.vdocuments.site/reader031/viewer/2022022011/5b0b5e2a7f8b9a45518de196/html5/thumbnails/20.jpg)
20
Which gives us finally:Which gives us finally:<?xml version="1.0"?><definitions
name="CurrencyExchangeService“targetNamespace="http://www.xmethods.net/sd/CurrencyExchangeService.wsdl"xmlns:tns="http://www.xmethods.net/sd/CurrencyExchangeService.wsdl"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"xmlns="http://schemas.xmlsoap.org/wsdl/"><message name="getRateRequest">
<part name="country1" type="xsd:string" /> <part name="country2" type="xsd:string" />
</message><message name="getRateResponse">
<part name="Result" type="xsd:float" /> </message>…
Which gives us finally (cont):Which gives us finally (cont):<portType name="CurrencyExchangePortType">
<operation name="getRate"><input message="tns:getRateRequest" /> <output message="tns:getRateResponse" />
</operation></portType><binding name="CurrencyExchangeBinding" type="tns:CurrencyExchangePortType"><soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" /> <operation name="getRate">
<soap:operation soapAction="" /> <input>
<soap:body use="encoded" namespace="urn:xmethods-CurrencyExchange"encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input><output>
<soap:body use="encoded" namespace="urn:xmethods-CurrencyExchange"encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output></operation>
</binding>…
![Page 21: Introduction to the Web Services Description Language …haim/teaching/iws/resources/Presentations/2002...1 Introduction to the Web Services Description Language (WSDL) Presented by](https://reader031.vdocuments.site/reader031/viewer/2022022011/5b0b5e2a7f8b9a45518de196/html5/thumbnails/21.jpg)
21
Which gives us finally (cont):Which gives us finally (cont):
…
<service name="CurrencyExchangeService"><documentation>Returns the exchange rate between the two currencies</documentation> <port name="CurrencyExchangePort" binding="tns:CurrencyExchangeBinding">
<soap:address location="http://services.xmethods.net:80/soap" /> </port>
</service>
</definitions>
<?xml version="1.0"?><definitions
name="CurrencyExchangeService"targetNamespace="http://www.xmethods.net/sd/CurrencyExchangeService.wsdl"xmlns:tns="http://www.xmethods.net/sd/CurrencyExchangeService.wsdl"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"xmlns="http://schemas.xmlsoap.org/wsdl/">
<message name="getRateRequest "><part name="country1" type="xsd:string" /> <part name="country2" type="xsd:string" />
</message><message name="getRateResponse">
<part name="Result" type="xsd:float" /> </message>
<portType name="CurrencyExchangePortType"><operation name="getRate ">
<input message="tns:getRateRequest" /> <output message="tns:getRateResponse" />
</operation></portType>
<binding name=" CurrencyExchangeBinding" type="tns:CurrencyExchangePortType"><soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" /> <operation name="getRate ">
<soap:operation soapAction="" /> <input>
<soap:body use="encoded" namespace="urn:xmethods-CurrencyExchange"encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input><output>
<soap:body use="encoded" namespace="urn:xmethods-CurrencyExchange"encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output></operation>
</binding>
<service name="CurrencyExchangeService"><documentation>Returns the exchange rate between the two currencies</documentation> <port name="CurrencyExchangePort" binding="tns: CurrencyExchangeBinding">
<soap:address location="http://services.xmethods.net:80/soap" /> </port>
</service>
</definitions>
Complete WSDL file:
![Page 22: Introduction to the Web Services Description Language …haim/teaching/iws/resources/Presentations/2002...1 Introduction to the Web Services Description Language (WSDL) Presented by](https://reader031.vdocuments.site/reader031/viewer/2022022011/5b0b5e2a7f8b9a45518de196/html5/thumbnails/22.jpg)
22
Questions?Questions?
DemosDemos
• Generation of code from WSDL.• Generation of WSDL from code.
![Page 23: Introduction to the Web Services Description Language …haim/teaching/iws/resources/Presentations/2002...1 Introduction to the Web Services Description Language (WSDL) Presented by](https://reader031.vdocuments.site/reader031/viewer/2022022011/5b0b5e2a7f8b9a45518de196/html5/thumbnails/23.jpg)
23
Tools supporting WSDLTools supporting WSDL
l IBM Web Services Toolkithttp://www.alphaworks.ibm.com/tech/webservicestoolkit
l Borland Jbuilderl Microsoft SOAP Toolkitl Microsoft Visual Studio .NETl Soap::Lite for Perl
http://www.soaplite.com/
l GLUE http://www.themindelectric.com/glue/index.html
l PocketSOAP http://pocketsoap.com/wsdl/
WSDL resourcesWSDL resources
l www.salcentral.com - searchable web services database
l www.xmethods.net - another searchable web services database
l www.searchWebServices.com - articles and information
![Page 24: Introduction to the Web Services Description Language …haim/teaching/iws/resources/Presentations/2002...1 Introduction to the Web Services Description Language (WSDL) Presented by](https://reader031.vdocuments.site/reader031/viewer/2022022011/5b0b5e2a7f8b9a45518de196/html5/thumbnails/24.jpg)
24
Questions?Questions?
ReferencesReferenceshttp://w3.org/TR/wsdl (WSDL Specification)http://www.xmethods.nethttp://www.searchWebServices.comhttp://www.w3.org/TR/xmlschema-2/ (XML Schema Specification)Clark, D., “Next-generation web services”, IEEE Internet Computing, Vol. 6, Issue 2, pp.
12-14, March-April 2002.Glass, G., “The Web services (r)evolution: Part 2 – Hello world, Web service-style”, IBM
developerWorks, February 2001 (http://www-106.ibm.com/developerworks/webservices/library/ws-peer2/)
Glass, G., “The Web services (r)evolution: Part 4 – Web Services Description Language (WSDL)”, IBM developerWorks, February 2001 (http://www-106.ibm.com/developerworks/webservices/library/ws-peer4/)
Myerson, J., “Testing for SOAP Interoperability”, Web Services Architect, February 26, 2002(http://www.webservicesarchitect.com/content/articles/myerson02print.asp )
Hondo, M., Nagaratnam, N., Nadalin, A., “Securing Web Services”, IBM Systems Journal, Vol. 41, No. 2, 2002.