0% found this document useful (0 votes)
118 views42 pages

Soap and WSDL: Satish Gummadelli

Uploaded by

Farooq Mohammed
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
118 views42 pages

Soap and WSDL: Satish Gummadelli

Uploaded by

Farooq Mohammed
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 42

SOAP and WSDL

Satish Gummadelli

I insert classification level


1 © Nokia Siemens Networks Technically Speaking/ DC-BLR-COO-OBS-EO-32
Objectives

SOAP

WSDL

Internal
2 © Nokia Siemens Networks Tech Presentation 14.11.07
Why SOAP

Client Proxy Server


App. Server
Application
Server

Firewall

Internal
3 © Nokia Siemens Networks Tech Presentation 14.11.07
Implications

Industry not shifted completely to either one

Vendor Specific

Lack of Interoperability

Internal
4 © Nokia Siemens Networks Tech Presentation 14.11.07
Why XML?

Simple text markup language

Platform, language and vendor agnostic

Easily extensible

Capable of solving interoperability problem

Internal
5 © Nokia Siemens Networks Tech Presentation 14.11.07
Why HTTP?

Ubiquitous

Supported by every web browser and server

Effective technology for transferring text, graphics and


other information

Internal
6 © Nokia Siemens Networks Tech Presentation 14.11.07
HTTP

HTTP communicates over TCP/IP. An HTTP client connects to


an HTTP server using TCP. After establishing a connection, the
client can send an HTTP request message to the server:
POST /item HTTP/1.1
Host: 189.123.345.239
Content-Type: text/plain
Content-Length: 200
Server Responses then with
200 OK
Content-Type: text/plain
Content-Length: 200

Internal
7 © Nokia Siemens Networks Tech Presentation 14.11.07
XML + HTTP = SOAP

HTTP is used for transport


XML as encoding scheme
 Endpoint HTTP based URL for the target
Object mapping: implementation specific
A SOAP request could be an HTTP POST or an HTTP GET
request.
SOAP Request example:
POST /item HTTP/1.1
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 250

Internal
8 © Nokia Siemens Networks Tech Presentation 14.11.07
SOAP call anatomy

Internal
9 © Nokia Siemens Networks Tech Presentation 14.11.07
SOAP Component

HTTP Headers Object Endpoint ID


SOAP method name Method/Interface ID

SOAP Envelope

SOAP Header Extension Headers

SOAP Body
Parameter Data

Internal
10 © Nokia Siemens Networks Tech Presentation 14.11.07
Uses of SOAP

SOAP greatly simplifies data exchange in B2B application


over extranet

Enables web site to integrate services from other sites

Remote scripting more prevalent with SOAP

Non-browser client could seamlessly access a service


across web

Internal
11 © Nokia Siemens Networks Tech Presentation 14.11.07
Uses of SOAP Skeleton of SOAP Message

<?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>

Internal
12 © Nokia Siemens Networks Tech Presentation 14.11.07
SOAP Envelope Element

The required SOAP Envelope element is the root element of a


SOAP message. It defines the XML document as a SOAP
message.

<?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">

... Message information goes here ...

</soap:Envelope>

Internal
13 © Nokia Siemens Networks Tech Presentation 14.11.07
SOAP Header Element

The optional SOAP Header element contains application


specific information (like authentication, payment, etc) about the
SOAP message. If the Header element is present, it must be
the first child element of the Envelope element.

<soap:Header>
<m:Trans xmlns:m="http://www.w3schools.com/transaction/"
soap:mustUnderstand="1">
234
</m:Trans>
</soap:Header>

SOAP Header Element Attributes:


actor,mustUnderstand,encodingStyle

Internal
14 © Nokia Siemens Networks Tech Presentation 14.11.07
Actor Attribute

The SOAP actor attribute may be used to address the Header


element to a particular endpoint.

<soap:Header>
<m:Trans xmlns:m="http://www.w3schools.com/transaction/"
soap:actor="http://www.w3schools.com/appml/">
234
</m:Trans>
</soap:Header>

Internal
15 © Nokia Siemens Networks Tech Presentation 14.11.07
mustUnderstand Attribute

The SOAP mustUnderstand attribute can be used to indicate


whether a header entry is mandatory or optional for the
recipient to process.

<soap:Header>
<m:Trans xmlns:m="http://www.w3schools.com/transaction/"
soap:mustUnderstand="1">
234
</m:Trans>
</soap:Header>

Internal
16 © Nokia Siemens Networks Tech Presentation 14.11.07
encodingStyle Attribute

The SOAP encodingStyle attribute is used to define the data


types used in the document. This attribute may appear on any
SOAP element, and it will apply to that element's contents and
all child elements. A SOAP message has no default encoding.

soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"

Internal
17 © Nokia Siemens Networks Tech Presentation 14.11.07
SOAP Body Element

The required SOAP Body element contains the actual SOAP


message intended for the ultimate endpoint of the message.

<?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>
..messages..
</soap:Body>
</soap:Envelope>

Internal
18 © Nokia Siemens Networks Tech Presentation 14.11.07
Example Message

<?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>
<m:GetPrice xmlns:m="http://www.w3schools.com/prices">
<m:Item>Apples</m:Item>
</m:GetPrice>
</soap:Body>

</soap:Envelope>

Internal
19 © Nokia Siemens Networks Tech Presentation 14.11.07
Example 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>

<m:GetPriceResponse xmlns:m="http://www.w3schools.com/prices">
<m:Price>1.90</m:Price>
</m:GetPriceResponse>
</soap:Body>
</soap:Envelope>

Internal
20 © Nokia Siemens Networks Tech Presentation 14.11.07
SOAP Fault

Used to carry error and/or status information within a SOAP


message…….Specify Mandatory field in SOAP Header
Appears within the SOAP body
Defines the following:
faultcode (mandatory)
algorithmic mechanism for identifying the fault
defined in the SOAP spec
Faultstring (mandatory)
human readable explanation of the fault

Internal
21 © Nokia Siemens Networks Tech Presentation 14.11.07
SOAP Fault cont..

SOAP Fault element has following sub elements


faultcode
faultstring
faultactor
detail

SOAP Fault codes are


VersionMisMatch
MustUnderstand
Client
Server

Internal
22 © Nokia Siemens Networks Tech Presentation 14.11.07
Soap Fault Example

<SOAP-ENV:Envelope
xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/”
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/”>
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>Internal Application Error</faultstring>
<detail xmlns:f=“http://www.a.com/CalculatorFault”>
<f:errorCode>794634</f:errorCode>
<f:errorMsg>Divide by zero</f:errorMsg>
</detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Internal
23 © Nokia Siemens Networks Tech Presentation 14.11.07
Conclusion

SOAP is platform independent, language neutral protocol

SOAP does not replace COM and CORBA

SOAP works in place of DCOM and IIOP

SOAP does not pose huge security risks

Supports interoperation between different vendor


specific implementations

Internal
24 © Nokia Siemens Networks Tech Presentation 14.11.07
WSDL Introduction

WSDL is an XML language that contains information about


the interface semantics and ‘administrivia’ of a call to a Web
Service

Once you develop a Web Service you publish its description


and a link to it in a UDDI repository so that potential users
can find it

When someone wants to use your service, they request the


WSDL file in order to find out the location of the service, the
function calls and how to access them

Then they use this information in your WSDL file to form a


SOAP request to the computer

Internal
25 © Nokia Siemens Networks Tech Presentation 14.11.07
WSDL Introduction

 WSDL is an XML-based language used to define Web


Services and describe how to access them.

WSLD is an XML format for describing


network services as a set of endpoints
operating on messages containing either
document-oriented or procedure-oriented
information.

Internal
26 © Nokia Siemens Networks Tech Presentation 14.11.07
Working of WSDL

Internal
27 © Nokia Siemens Networks Tech Presentation 14.11.07
Working of WSDL cont..

Internal
28 © Nokia Siemens Networks Tech Presentation 14.11.07
Working of WSDL cont..

Internal
29 © Nokia Siemens Networks Tech Presentation 14.11.07
Working of WSDL cont..

A client can invoke a web service using SOAP, HTTP


GET/POST and MIME.
WSDL Document Structure
•<definition> - Root element
•<types> - Provides data type definitions
•<message> - Represents the abstract definition of the data
being transmitted
•<port Type> - Defines a set of abstract operations
•<binding> - Specifies concrete protocol and data format
specifications for the operations and messages defined by
a particular port Type
•<port> - Specifies an address for a binding
•<service> - Used to aggregate a set of related ports.

Internal
30 © Nokia Siemens Networks Tech Presentation 14.11.07
Namespace

The XML namespace prefix are used to indicate the


namespace of the element being defined
All WSDL elements belong to the WSDL namespace,
defined as http://schemas.xmlsoap.org/wsdl/
For WSDL SOAP binding,
http://schemas.xmlsoap.org/wsdl/soap/
For WSDL HTTP GET and POST binding,
http://schemas.xmlsoap.org/wsdl/http/
For WSDL MIME binding,
http://schemas.xmlsoap.org/wsdl/mime/

Internal
31 © Nokia Siemens Networks Tech Presentation 14.11.07
Service

A service groups a set of related ports together

Let is consider an example of a Web Service and the


GetTemperature method as an operation on that service.
<definitions name=‘weatherservice’
xmlns=‘http://schemas.xmlsoap.org/wsdl/’>
<type>
<xsd:schema … />
</type>
<service name=‘WeatherService’ >

</service>
</definitions>

Internal
32 © Nokia Siemens Networks Tech Presentation 14.11.07
Port

A port defines an individual endpoint by specifying a single


address for a binding
<port name=‘WeatherSoapPort’
binding=‘wsdlns:WeatherSoapBinding’ >
<soap:address
location=‘http://localhost/demos/wsdl/devx
pert/weatherservice.jsp’ />
</port>
Each port has a unique name and a binding attribute
A web service may be accessible on many ports
A port MUST NOT specify more than one address
A port MUST NOT specify any binding information other than
address information

Internal
33 © Nokia Siemens Networks Tech Presentation 14.11.07
Message

A message is protocol independent


There is an input or request message, which is sent from the
client to the service, and there is a output or response
message, which is sent back the opposite way
Each <message> element contains one or more <part>
elements.
<part> element corresponds to the parameter or a return
value in the RPC call.
The part name order reflects the order of the parameters in
the RPC signature.

Internal
34 © Nokia Siemens Networks Tech Presentation 14.11.07
Message cont..

<message name=‘Weather.GetTemperature’ >


<part name=‘zipcode’ type=‘xsd:string’ />
<part name=‘celsius’ type=‘xsd:boolean’ />
</message>
<message name=‘Weather.GetTemperatureResponse’ >
<part name=‘Result’ type=‘xsd:float’ />
</message>

Internal
35 © Nokia Siemens Networks Tech Presentation 14.11.07
Operations and Port Type

Operation defines which message is the input and which


message is the output
A collection of all operations exposed bythe web service is
called a portType
<portType name=‘WeatherSoapPort’>
<operation name=‘GetTemperature’ parameter
Order=‘zipcode celsius’>
<input message=‘wsdlns:Weather.GetTemperature’ />
<output message=‘wsdlns:Weather.GetTemperatureResponse’ />
</operation>
<!– other operations 
</portType>

Internal
36 © Nokia Siemens Networks Tech Presentation 14.11.07
Operations and Port Type

WSDL has four transmission primitives that an endpoint can


support:
One-Way – The endpoint receives a message
<wsdl:input>
Request-response – The endpoint receives a
message and sends a correlated message
<wsdl:input>,<wsdl:output>,<wsdl:fault>
Solicit-response – The endpoint sends a message and
receives a correlated message
<wsdl:output>, <wsdl:input>, <wsdl:fault>
Notification – The endpoint sends a message
<wsdl:output>

Internal
37 © Nokia Siemens Networks Tech Presentation 14.11.07
Binding

Binding mechanism is used to attach a specific protocol, data


format or structure to an abstract message , operation or
endpoint
Binding MUST specify exactly one protocol
Binding MUST NOT specify address information
Extensibility elements are commonly used to specify some
technology specific binding
<binding name=‘WeatherSoapBinding’ type=‘wsdlns:WeatherSoapPort’ >

</binding>

Internal
38 © Nokia Siemens Networks Tech Presentation 14.11.07
SOAP Binding

<soap:binding> - Signifies that the binding is bound to the


SOAP protocol format: Envelope, Header and Body
<binding …>
<soap:binding transport=“uri”? Style=“rpc|document”?>
</binding>
<soap:operation> - Provides information for the document as
a whole
<binding …>
<operation …>
<soap:operation soapAction=“uri”? Style=“rpc|document”?>
</operation>

</binding>

Internal
39 © Nokia Siemens Networks Tech Presentation 14.11.07
SOAP Binding cont..

<soap:body> - Specifies how the message parts appear inside the SOAP
Body element
<input>
<soap:body parts=“nmtokens”? use=“literal|encoded”?
encodingStyle=“uri-list”? Namespace=“uri”?>
</input>
<soap:fault> - Specifies the contents of the contents of the SOAP fault
<fault>
<soap:fault name=“nmtoken” use=“literal|encoded” encodingStyle=“uri-
list”? Namespace=“uri”?>
</fault>

Internal
40 © Nokia Siemens Networks Tech Presentation 14.11.07
SOAP Binding cont..

<soap:header> and <soap:headerfault> - Allow headers to be defined that


are transmitted inside the Header element of the SOAP Envelope
<input>
<soap:header message=“qname” part=“nmtoken” use=“literal encoded”?
encodingStyle=“uri-list”? Namespace=“uri”?>
<soap:headerfault message=“qname” part=“nmtoken”
use=“literal|encoded”? encodingStyle=“uri-list”? Namespace=“uri”?>
</input>
<soap:address> - Used to give a port an address (a URI)
<binding …>
<soap:address location=“uri” />
</binding>

Internal
41 © Nokia Siemens Networks Tech Presentation 14.11.07
References

World Wide Web Consortium


http://www.w3c.org/TR/wsdl

DevXpert
http://www.devxpert.com/tutors/wsdl/wsdlprint.asp

Sun Java Website


http://dcb.sun.com/practices/webservices/overviews/overview_
wsdl.jsp

Internal
42 © Nokia Siemens Networks Tech Presentation 14.11.07

You might also like