Search 800 + Posts

Oct 6, 2009

What is SOAP?


What is SOAP

SOAP is a simple XML-based protocol to let applications exchange information over HTTP.
Soap stands for “Simple Object Access Protocol”. It is a way for communication between the applications and it is based on XML.

SOAP lets you build applications by remotely invoking methods on objects. SOAP removes the requirement that two systems must run on the same platform or be written in the same programming language. Instead of invoking methods through a proprietary binary protocol, a SOAP package uses XML, a text-based syntax for making method calls. All information between the requesting application and the receiving object is sent as tagged data in an XML stream over HTTP. From a Web services point of view, SOAP may be implemented as either a client or a server.

A SOAP client is a program that creates an XML document containing the information needed to invoke remotely a method in a distributed system.
A SOAP server is simply special code that listens for SOAP messages and acts as a distributor and interpreter of SOAP documents

Message Format
SOAP does all this in the context of a standardized message format. The primary part of this message has a MIME type of "text/xml" and contains the SOAP envelope. This envelope is an XML document. The envelope contains a header (optional) and a body (mandatory). The body part of the envelope is always intended for the final recipient of the message, while the header entries may target the nodes that perform intermediate processing. Attachments, binary or otherwise, may be appended to the body.

SOAP provides a way for the client to specify which of the intermediate processing nodes has to deal with what header entry. Because headers are orthogonal to the main content of the SOAP message, they're useful in adding information to the message that doesn't effect the processing of the message body.

Essential elements of a Soap Message.
1. An Envelop Element.
2. An header Element
3. A Body Element
4. A fault Element.

For any detail information of Soap and related Standards please refer http://www.w3.org
Since SOAP is XML based, all the elements of Soap are declared in namespace.
1. Name Space for SOAP envelope: http://www.w3.org/2001/12/soap-envelope
2. Default namespace for SOAP encoding and data types is:
http://www.w3.org/2001/12/soap-encoding

Skeleton SOAP Message












SOAP Envelope Element
The SOAP Envelope element is the root element of a SOAP message.
SOAP Header Element
The SOAP Header element contains header information.It is OPTIONAL .If the Header element is present, it must be the first child element of the Envelope element.Note: All immediate child elements of the Header element must be namespace-qualified.



SOAP Header has 3 Attributes
1. mustUnderstand,
2. actor, and
3. encodingStyle.

The attributes defined in the SOAP Header defines how a recipient should process the SOAP message.
The SOAP mustUnderstand attribute can be used to indicate whether a header entry is mandatory or optional for the recipient to process.
The actor Attribute
The SOAP actor attribute is used to address the Header element to a specific endpoint.
The encodingStyle Attribute
The encodingStyle attribute is used to define the data types used in the document

SOAP Body Element
The SOAP Body element contains the actual SOAP message. It is mandatory.
The SOAP Body Element

The required SOAP Body element contains the actual SOAP message intended for the ultimate endpoint of the message. Immediate child elements of the SOAP Body element may be namespace-qualified.
 Request


The example above requests header_id associated with the Line_id. Note that the target: getheaderid and the line_id elements above are application-specific elements. They are not a part of the SOAP namespace.
A SOAP response could look something like this:



Response return with the value “1” for the header_id associated with line_id = 100

SOAP Fault Element
The SOAP Fault element holds errors and status information for a SOAP message.
If a Fault element is present, it must appear as a child element of the Body element. A Fault element can only appear once in a SOAP message.

1 comment:

  1. Good work .I am looking for some info abt how to call a BPEL from pl/SQL code through SOAP

    ReplyDelete