SOAP:
SOAP is
an acronym for Simple Object Access Protocol. SOAP defines a protocol for
message exchange between applications. SOAP provides a way to communicate
between applications running on different operating systems, with different
technologies and programming languages.
SOAP
describes envelope and message formats, and has a basic request/response SOAP
is a communication protocol
SOAP is
for communication between applications SOAP is a format for sending messages
SOAP
communicates via Internet SOAP is platform independent
SOAP is
language independent SOAP is based on XML
SOAP is
simple and extensible
SOAP is a
W3C recommendation SOAP Building Blocks
A SOAP
message is an ordinary XML document containing the following elements:
An
Envelope element that identifies the XML document as a SOAP message A Header
element that contains header information
A Body
element that contains call and response information A Fault element containing
errors and status information
Structure of SOAP Message
The following code fragment gives an outline of the
SOAP message // code for HTTP binding
HTTP binding
// used
to directs the message
Envelop
// helps the
server to identify the message as SOAP
Header
// Optional.
It adds features to SOAP message such as authentication, message route etc.
Body
//
contain actual message
<soap:Envelope
xmlns:soap="uri" soap:encodingStyle="uri">
<soap:Header>
... ...
...
</soap:Header>
<soap:Body>
... ...
...
<soap:Fault>
... ...
...
</soap:Fault>
</soap:Body>
</soap:Envelope>
The SOAP
Envelope element is the root element of a SOAP message. This element defines
the XML document as a SOAP message. The xmlns:soap namespace defines the
Envelope as a SOAP Envelope. The encodingStyle attribute is used to define the
data types used in the document.
The SOAP
Header element contains header information. If the Header element is present,
it must be the first child element of the Envelope element.
The SOAP
Body element contains the actual SOAP message intended for the ultimate
endpoint of the message.
The SOAP
Fault element holds errors and status information for a SOAP message.
A SOAP
Example
In the
example below, a GetStockPrice request is sent to a server. The request has
a
StockName and Price parameters that will be returned in the response. The
namespace for the function is defined in "http://www.example.org/stock".
A SOAP request:
POST
/InStock HTTP/1.1 Host: www.example.org
Content-Type:
application/soap+xml; charset=utf-8 Content-Length: n bytes
<?xml
version="1.0"?>
<soap:Envelope
xmlns:soap="uri" soap:encodingStyle="uri"> <soap:Body
xmlns:m="http://www.example.org/stock"> <m:GetStockPrice>
<m:StockName>IBM</m:StockName>
</m:GetStockPrice>
</soap:Body>
</soap:Envelope>
The SOAP response:
HTTP/1.1
200 OK
Content-Type:
application/soap+xml; charset=utf-8 Content-Length: n bytes
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="uri" soap:encodingStyle="uri"> <soap:Body
xmlns:m="http://www.example.org/stock">
<m:GetStockPriceResponse>
<m:Price>34.5</m:Price>
</m:GetStockPriceResponse>
</soap:Body>
</soap:Envelope>
SOAP and
HTTP
A SOAP
method is an HTTP request/response that complies with the SOAP encoding rules.
SOAP message is HTTP + XML = SOAP.
A SOAP
request could be an HTTP POST or an HTTP GET request.
Java support for SOAP
Java
provides support for creating and manipulating SOAP documents through SAAJ
which is an acronym of Soap with Attachments Api for Java. This API is part of
JWSDP. Related technologies
The
alternative for creating web services using JSWDP is sun J2EE platform, Apache
Axis.
Also,
IBM, WebSphere, BEA and WebLogic development platforms are alternative tools
for developing java based web services.
Personal
Home Page (PHP) development platform can also be used for creating web
services. It contains PEAR (Personal home page Extension and Application
Repository) for parsing a WSDL document.
UDDI
(Universal Discovery Description and Integration) is used to register and
locate web services. Alternative to UDDI is JAXR (Java Api for Xml Registry)
WS-I
Basic Profile (Web Service Interoperability Basic Profile) is a tool which
helps the developers how to use various web service technologies.
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.