WSDL
Day One Revision ⌘
- Introduction
- Service-Oriented Architecture
- Web Services Overview
- XML
- SOAP
SOA & Web Services ⌘
Service-Oriented Architecture
Without Agreed standards
Atomic
Interoperability
Service Request
Loose coupling
Brittleness
Hide information (service abstraction)
10. Are reusable services: a. used many times b. used in multiple processes
b. Used in multiple processes
Name the features ⌘
- <?xml version="1.0" encoding="utf-8"?>
- <mySoap:Envelope
- xmlns:mySoap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsx="http://www.webserviceX.NET">
- <mySoap:Header/>
- <mySoap:Body>
- <wsx:GetAtomicNumber>
- <wsx:ElementName>Oxygen</wsx:ElementName>
- </wsx:GetAtomicNumber>
- </mySoap:Body>
- </mySoap:Envelope>
Name the features (answers) ⌘
- Prolog
- Root Element
- SOAP Envelope
- Namespace Declaration
- Attribute
- SOAP Header
- SOAP Body
- Body Block
- Element
- Namespace
Day Two Schedule ⌘
- WSDL
- Handling Binary Content
- RESTfull Web Services
- Other Technologies
- Conclusion
WSDL ⌘
WSDL Metaphor ⌘
- XML = Language of message
-English
- SOAP = Style of message
-Business letter
- WSDL = specific instructions on what to write + what the response will be
11/18/2013 Pete George NobleProg Dear Sir
NobleProg Chiswick 123456789 123456789 someone@nobleprog.com
Interface Definition Language ⌘
- Defines language for ORB interfaces (e.g. CORBA)
- Objects have defined contract with outside world
-Methods
-Method parameters
-Return values
- Usually interface investigated during programming
Web Services Description Language ⌘
- Standardized way to describe a Web service
- Not language-specific
-Describes data to be passed
-Describes method for passing data
- The basis of the original Web services specification
- WSDL 2.0 Became W3C recommendation 2007
- Originally used in conjunction with UDDI
UDDI Registry ⌘
- Universal Description, Discovery, and Integration
- Intended to provide way to discover Web services
-contact information for organisations
-services available from organisations
- Not been widely implemented
WSDL with UDDI ⌘
1. Services Described Using WSDL ⌘
- Service Provider describes its service using WSDL
- Definition published to registry of services
- Registry uses UDDI
2. Registry Services Queried ⌘
- Service Consumer issues one or more queries to registry:
-to locate a service
-to determine how to communicate with service
3. WSDL Service Details Supplied ⌘
- Registry provides response to Consumer queries
- i.e WSDL section containing details of the Provider’s requests and responses
4. Service Request Sent ⌘
- Service Consumer has WSDL request details passed from UDDI registry
- Service Consumer sends XML request
5. Service Response Returned ⌘
- Service Provider sends XML request
- Service Consumer knows from WSDL details (passed from UDDI Registry) what response message should look like
WSDL without UDDI ⌘
1. Service Request Sent ⌘
- Service Consumer knows WSDL request details
- Service Consumer sends XML request
2. Service Response Returned ⌘
- Service Provider sends XML request
- Service Consumer knows from WSDL details what response message should look like
Obtaining WSDL ⌘
- Usually by simple request, e.g.
GET
http://www.webservicex.net/periodictable.asmx?wsdl
<definitions> ⌘
- Root Element
- Includes Namespace declarations
- Includes WSDL and SOAP declarations
Periodic Table <definitions> ⌘
<types> ⌘
- WSDL file builds up in levels – starts with data types
- Defined in terms of XML Schema
Periodic Table <types> ⌘
<wsdl:definitions xmlns:s="http://www.w3.org/2001/XMLSchema"> <wsdl:types> <s:schema <s:element name="GetAtomicNumber"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="ElementName" type="s:string" /> </s:sequence> </s:complexType> </s:element>
<messages> ⌘
- Defines content
-What the message is
-What kind of data it holds
Periodic Table <messages> ⌘
Periodic Table SOAP message ⌘
- Can be translated into SOAP message, e.g.
<portType> ⌘
- Define individual operations provided by service
-Input and Output operations
-Consist of messages
<portType> ⌘
<binding> ⌘
- Binds operations to protocol, includes:
-<soap:binding>
- specifies binding to SOAP
- Transport type, e.g. HTTP
-<soap:operation>
- Specifies SOAPAction header – redundant
-<soap:body>
- Define how messages are presented
- Literal or encoded
<binding> ⌘
<service> ⌘
- <port> How to send the information
-Binding information, e.g. <wsdl:port name="periodictableSoap" binding="tns:periodictableSoap">
- <soap:address> Where to send the information
-Location of the Web service, e.g.
<soap:address location="http://www.webservicex.net/periodictable.asmx" />
<service> ⌘
<wsdl:service name="periodictable"> <wsdl:port name="periodictableSoap" binding="tns:periodictableSoap"> <soap:address location="http://www.webservicex.net/periodictable.asmx" /> </wsdl:port>
Summary Exercise 1 ⌘
Using the JMeter test tool, create a SOAP Service Request to retrieve the weight of an atom from the Periodic Table Web service.
See:
http://www.webservicex.net/periodictable.asmx?wsdl
(you might like to open the WSDL in a separate JMeter instance while you work)
- Start from PortType = "periodictableSoap"
- Create Message
- Use appropriate Types
Summary Exercise 2 ⌘
Confirm Exercise 1 SOAP message is correct:
- Pull Periodic Table WSDL into SoapUI
- Execute Ex1 SOAP message in JMeter. Compare Response Message with expected Response message in WSDL.
- Repeat exercise with own WSDL.