wsdl : web service definition language dr. yuhong yan nrc-iit-fredericton internet logic
TRANSCRIPT
![Page 1: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/1.jpg)
WSDL : Web Service Definition Language
Dr. Yuhong YanNRC-IIT-Fredericton
Internet logic
![Page 2: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/2.jpg)
WSDL: describe a web services
• Initialized by IBM, Microsoft, Ariba and 6~ other companies
• 2004.8: w3c releases WSDL 2.0
![Page 3: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/3.jpg)
Interoperability Using WSDL
Get WSDL docInvoke Service
J2EE ContainerService Objects
WSDL description
Client
Service
Service
SOAP
HTTP
![Page 4: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/4.jpg)
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
![Page 5: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/5.jpg)
WSDL:
• A contract between requestor and provider• Platform and language-independent• Describe SOAP services• Automatic tool to generate client and sever code
![Page 6: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/6.jpg)
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
![Page 7: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/7.jpg)
An example of WSDL: HelloWorld
<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">
Root element, defines namespaces
WSDL-SOAP binding
xmlschema
WSDL schema
Convention, refer to itself (?)WSDL uses it to generate package name
![Page 8: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/8.jpg)
<Service>
<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>
Where is the service located?
The service location: the endpoint of the SOAP message
![Page 9: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/9.jpg)
<Binding>
<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>
Bind messages to operationsUse SOAP HTTP protocol
![Page 10: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/10.jpg)
<portType>
<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>
Bind messages to operations
Operation: sayHello
Input Message: sayHelloRequest
Output Message: sayHelloResponse
![Page 11: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/11.jpg)
<message>
<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>
Define message: sayHelloRequestContent of message
Define massage: sayHelloResponse
Parameter 1, type stringParameter 2, type string
Parameter 1, type string
![Page 12: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/12.jpg)
Structure of WSDL
P121 fig 6-1
<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?
![Page 13: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/13.jpg)
Definition: <wsdl:definitions>
• Root element• Name of the web service• Declare multiple namespaces
![Page 14: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/14.jpg)
Complex data types: <types>
• Not used if limit to XML schema• Define complex types (correspondent to a class
in java)
![Page 15: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/15.jpg)
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
![Page 16: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/16.jpg)
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>
![Page 17: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/17.jpg)
Operation patterns supported by WSDL 1.1
P126. fig 6-3
Client
One-way
Request-response
Client
Client
Client
Solicit-response
Notification
Service<input>
Service
Service
Service
<input>
<output>
<output>
<input>
<output>
1
1
2
2
![Page 18: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/18.jpg)
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
![Page 19: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/19.jpg)
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
![Page 20: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/20.jpg)
Transmission protocols: <binding>
• Binding transmission protocols to operations• Axis: http
![Page 21: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/21.jpg)
Service location: <service>
• SOAP endpoint of the web service
![Page 22: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/22.jpg)
Second example: WSDL of StockQuote
• Deploy the sample StockQuoteService• The WSDL is at
http://localhost:8080/axis/services/urn:xmltoday-delayed-quotes?wsdl
![Page 23: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/23.jpg)
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>
![Page 24: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/24.jpg)
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>
![Page 25: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/25.jpg)
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>
![Page 26: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/26.jpg)
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>
![Page 27: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/27.jpg)
WSDL Summary
<definitions>:The StockQuoteService
<message>:1) getQuoteRequest: parameter:symbol; type: string2) 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
![Page 28: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/28.jpg)
Using WSDL with Axis
• Obtaining WSDL for deployed services• WSDL2Java: Building stubs, skeletons, and data• Java2WSDL: Building WSDL from Java
![Page 29: WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c01f1a28abf838cd1efa/html5/thumbnails/29.jpg)
Obtain WSDL for deployed services
• Axis generates WSDL for any deployed services• In the service list, check the WSDL files