Simple object access protocol is an open standard, xml based messaging protocol for exchanging information among computers. It can extend HTTP for XML messaging and provides data transport for web services. Soap is platform and language independent.
Message Structure:
A SOAP message is an ordinary XML containing the following elements –
Envelope:
The soap envelope indicates the start and end of the message so that the receiver knows when an entire message has been received. Some important points are –
• Every SOAP message has a root envelope element.
• Every envelope element must contain exactly one body element.
• If an Envelope contains a Header element, it must contain no more than one, and it must appear as the first child of the Envelope, before the Body.
• The envelope changes when SOAP versions change.
• The SOAP envelope is specified using the ENV namespace prefix and the Envelope element.
<SOAP-ENV:Envelope
xmlns:SOAP-ENV = "http://www.w3.org/2001/12/soap-envelope"
SOAP-ENV:encodingStyle = " http://www.w3.org/2001/12/soap-encoding">
Message information goes here
</SOAP-ENV:Envelope>
Header:
the Header element can be used to specify a digital signature for password-protected services. Some important points are –
• it is an optional part of a soap message.
• Header elements can occur multiple times.
• Header are intended to add new features and functionality.
• When multiple headers are defined, all immediate child elements of the SOAP header are interpreted as SOAP header blocks.
<SOAP-ENV:Header>
<t:Transaction
xmlns:t = "http://www.reviewko.in/transaction/"
SOAP-ENV:mustUnderstand = "true">5
</t:Transaction>
</SOAP-ENV:Header>
Body:
This element contains the actual data which need to be sent between the web service and calling application.
<SOAP-ENV:Body>
<m:GetQuotation xmlns:m = "http://www.tp.com/Quotation">
<m:Item>Computers</m:Item>
</m:GetQuotation>
</SOAP-ENV:Body>
Fault:
The SOAP fault mechanism returns specific information about the error, including a predefined code, a description, and the address of the SOAP processor that generated the fault. It has some sub elements –
• <faultCode> - It is a text code used to indicate a class of errors. VersionMismatch, MustUnderstand, Client, Server these are some faultcode values.
• <faultString> - it is a text message explaining the error.
• <faultActor> - It is a text string indicating who caused the fault.
• <detail> - It is an element used to carry application-specific error messages.
<SOAP-ENV:Fault>
<faultcode xsi:type = "xsd:string">SOAP-ENV:Client</faultcode>
<faultstring xsi:type = "xsd:string">
Failed to locate method (ValidateCreditCard) in class (examplesCreditCard) at
/usr/local/ActivePerl-5.6/lib/site_perl/5.6.0/SOAP/Lite.pm line 1555.
</faultstring>
</SOAP-ENV:Fault>
Comments
Post a Comment