SOAP Web Services Part-1

Laboratory of Service Design and Engineering
2011/2012
Muhammad Imran: Lab Lectures for LSDE‐2011/2012 .
Outline
y What is SOAP?
y Web Services with SOAP
y WSDL
y Client Implementation
y Exercise
Simple Object Access Protocol
What is SOAP?
SOAP stands for Simple Object Access Protocol
2. SOAP is essentially an XML‐based protocol for invoking remote methods.
1.
3. SOAP is a protocol for accessing a Web Service.
4. SOAP is a format for sending messages 5. SOAP communicates via Internet 6. SOAP is platform independent 7. SOAP is language independent Simple Object Access Protocol
y A SOAP message is an ordinary XML document containing the following elements:
y An Envelope element that identifies the XML document as a SOAP message
y A Header element that contains header information
y A Body element that contains call and response information
y A Fault element containing errors and status information
Skeleton SOAP Message
A SOAP Request Example
SOAP Request
SOAP Response Example
Web Service Middle‐Ware
Invoking JWS Service
y Two options
y Using Dynamic Invocation Interface (DII)
y Using Stubs generated from service WSDL description
Client Code: DII Method
Web Service Description Language
WSDL
y WSDL stands for Web Services Description Language.
y WSDL is a document written in XML. y The document describes a Web service. y It specifies the location of the service and the operations (or methods) the service exposes.
WSDL
y A WSDL document describes a web service using these major elements:
y <types>
y The data types used by the web service y <message>
y The messages used by the web service y <portType>
y The operations performed by the web service y <binding>
y The communication protocols used by the web service
WSDL Example
Example Service y Length Convertor Service
Length Convertor
y What we need
y A service (Already implemented at webservicex.net)
y Service WSDL
y
Download it http://www.webservicex.net/length.asmx?WSDL
y Stubs y
Generate stubs from WSDL
y Write client using stubs
y Access the service (pass parameter and get results)
Lets do it
Exercise
y Access the Currency Convertor Service
y Download WSDL file from
y http://www.webservicex.net/CurrencyConvertor.asmx?
WSDL
y Generate stubs using WSDL file. y Use given build.xml y Create Client using stubs.
y Convert any currency to other currency type.