11
Establishing a foundation for web services Ashraf Memon

Establishing a foundation for web services Ashraf Memon

Embed Size (px)

Citation preview

Page 1: Establishing a foundation for web services Ashraf Memon

Establishing a foundation for web services

Establishing a foundation for web services

Ashraf MemonAshraf Memon

Page 2: Establishing a foundation for web services Ashraf Memon

2

Overview

• SOAP 101

• WSDL 101

Page 3: Establishing a foundation for web services Ashraf Memon

3

SOAP 101

• SOAP stands for Simple Object Access Protocol • SOAP is a communication protocol • SOAP is for communication between applications • SOAP is a format for sending messages • SOAP is designed to communicate via Internet • SOAP is platform independent • SOAP is language independent • SOAP is based on XML • SOAP is simple and extensible

Page 4: Establishing a foundation for web services Ashraf Memon

4

<?xml version="1.0"?> <soap:Envelope

xmlns:soap="http://www.w3.org/2001/12/soap-envelope“ soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Header> ... ... </soap:Header><soap:Body> ... ...

<soap:Fault> ... ... </soap:Fault>

</soap:Body></soap:Envelope>

SOAP Skeleton

Soap Body

SOAP Envelope

SOAP Header

Parameters

SOAP Body

Page 5: Establishing a foundation for web services Ashraf Memon

5

Example Soap Request

<?xml version="1.0"?> <soap:Envelope

xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <soap:Body xmlns:m="http://www.stock.org/stock">    <m:GetStockPrice>

<m:StockName>IBM</m:StockName>     </m:GetStockPrice> </soap:Body>

</soap:Envelope>

Page 6: Establishing a foundation for web services Ashraf Memon

6

Example Soap Response

<?xml version="1.0"?> <soap:Envelope

xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <soap:Body xmlns:m="http://www.stock.org/stock">

<m:GetStockPriceResponse> <m:Price>34.5</m:Price>

</m:GetStockPriceResponse> </soap:Body>

</soap:Envelope>

Page 7: Establishing a foundation for web services Ashraf Memon

7

WSDL 101

• WSDL stands for Web Services Description Language

• WSDL is written in XML

• WSDL is an XML document

• WSDL is used to describe Web services

• WSDL is also used to locate Web services

Page 8: Establishing a foundation for web services Ashraf Memon

8

WSDL Elements

Element Defines<portType> The operations performed by the web service<message> The messages used by the web service<types> The data types used by the web service<binding> The communication protocols used by the web

service

A WSDL document describesWhat the service can doWhere it residesHow to invoke it

Page 9: Establishing a foundation for web services Ashraf Memon

9

WSDL Skeleton

<definitions>

<types> definition of types........ </types> <message> definition of a message.... </message>

<portType> definition of a port....... </portType>

<binding> definition of a binding.... </binding>

</definitions>

Page 10: Establishing a foundation for web services Ashraf Memon

10

WSDL Example

<message name="getTermRequest"> <part name="term" type="xs:string"/></message><message name="getTermResponse"> <part name="value" type="xs:string"/></message><portType name="glossaryTerms"> <operation

name="getTerm"> <input message="getTermRequest"/> <output message="getTermResponse"/> </operation></portType>

Page 11: Establishing a foundation for web services Ashraf Memon

11

Next Chapter

• Creating Web Service