Tutorials Hut




  • What is SOAP Web service & its Structure

    This article will present you with a complete idea about SOAP Web service and how the SOAP message look like .

    1-What is SOAP Web service & its Structure

    What is SOAP WebService?

    • SOAP stands for Simple Object Access Protocol.
    • It is is a W3C standard
    • SOAP is an XML-based messaging protocol for exchanging information among computers.
    • It is a XML-based protocol for accessing web services.
    • It defines a set of rules for structuring messages that can be used for simple one-way messaging but is particularly useful for performing RPC-style (Remote Procedure Call) request-response dialogues
    • SOAP is designed to communicate via Internet
    • SOAP is based on XML
    • SOAP is platform and language independent
    • SOAP enables client applications to easily connect to remote services and invoke remote methods.
    3- SOAP message Structure- SOAP

    SOAP message Structure

    SOAP message consists of three parts:

      • SOAP Envelope
      • SOAP Header (optional)
      • SOAP Body

    SOAP message Skelton:

    <?xml version="1.0" encoding="UTF-8"?>
    <soap:Envelope
    soap:encodingStyle="http://soap.org/soap/encoding/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:soap="http://xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-inst">
    <soap:Header>
    <!-- Transactions, priorites, etc. -->
    </soap:Header>
    <soap:Body>
    <!-- Some content -->
    </soap:Body>
    </soap:Envelope>
    
    
    

    SOAP Envelope:

      • The SOAP Envelope construct defines an overall framework for expressing what is in a message and who should deal with it.
      • The Envelope is the top element of the XML document representing the message.
      • The Envelope element is always the root element of a SOAP message.
      • The Envelope element contains an optional Header element followed by a mandatory Body element.

    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>
           <m:GetLastTradePriceResponse xmlns:m="Some-URI">
               <Price>67</Price>
           </m:GetLastTradePriceResponse>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    
    

    SOAP Header:

      • Header is optional
      • SOAP header element can contain information such as authentication credentials which can be used by the calling application.
      • It can also contain the definition of complex types which could be used in the SOAP message.
      • By default, the SOAP message can contain parameters which could be of simple types such as strings and numbers, but can also be a complex object type.

    Example:

    <soap:Header> 
    	<!-- security credentials --> 
    	<s:credentials xmlns:s="urn:examples-org:security"> 	<username>abc</username> 
    	<password>test123</password> 
    	</s:credentials> 
    </soap:Header>
    
    

    SOAP Body:

    • The Body element represents the message payload
    • The SOAP body is a mandatory element that contains the application-defined XML data being exchanged in the SOAP message.
    • Immediate child elements of the SOAP Body element may be namespace-qualified.

    Example:

    <soap:Body> 
    	<x:TransferFunds xmlns:x="urn:examples-org:banking"> 
    	<from>22-342439</from> 
    	<to>98-283843</to> 
    	<amount>100.00</amount> 
    	</x:TransferFunds> 
    </soap:Body> 
    
    
    3- SOAP message Structure- SOAP













  • Leave a Reply

    Your email address will not be published. Required fields are marked *