Saturday, April 23, 2016

SOAP(Simple Object Access Protocol)

I have bring a New Topic to discuss in this Article that is SOAP. Here SOAP stands for Simple Object Access Protocol.In this post we discuss about what is SOAP?Use of SOAP.
Where do we apply this topic in real time software projects.


SOAP version 1.2 provides a simple and light weight mechanism for exchanging structured and typed information between peers in a decentralized,distributed environment using XML.

It is and XML based protocol that consists of four parts:


  •  The SOAP envelope construct defines an overall framework for expressing what is in a message,who should deal with it,and whether it is optional or mandatory.
  • The SOAP encoding rules defines a serialization mechanism that can be used to exchange instances of application-defined datatypes.
  • The SOAP RPC representation defines a convention that can be used to represent remote procedure calls and responses.
  • The SOAP binding defines a convention for exchanging SOAP envelopes between peers using an underlying protocol for transport.
SAMPLE SOAP MESSAGE EMBEDDED IN AN HTTP REQUEST:

post/stockquote/HTTP/1.1
Host:www.stockqoteserver.com
content-Type:text/XML;charset="Utf-8
SOAPAction:http://example.org/2016/04/quotes

<env:Envelope xmlns:env-http://www.w3.org/2016/04/soap-envelope>
<env:body>
<m:GetLastTradePrice env:encodingstyle=http://www.w3.org/2016/04/soap-encodingxmlns:m=http://example.org/2016/04/quotes>
<symbol>DIS</symbol>
</m:GetLastTradePrice>
</env:body>
</env:Envlope>

SAMPLE SOAP MESSAGE EMBEDDED IN AN HTTP  RESPONSE:

HTTP/1.1 200 ok
Content-Type: Text/xml;charset="utf-8 content-length"nnnn

<env:Envelope xmlns:env-http://www.w3.org/2016/04/soap-envelope>

<env:body>
<m:GetLastTradePriceResponse env:encodingstyle=http://www.w3.org/2016/04/soap-encoding "xmlns:m=http://example.org/2016/04/quotes">
<Price>44.5</price>
</m:GetLastTradePriceResponse>
</env:body>
</env:Envlope>

SOAP MESSAGE:



SOAP Supports two different communication Styles:

a)SOAP-RPC
b)SOAP-HTTP

a)SOAP-RPC:

SOAP request using RPC based communication

<SOAP ENV:Envelope xmlns:SOAP-
                           ENV="http://schema.xmlsoap.org/soap/enveloper
                         xmlns:xsl="http://www.w3c.org/2016/xmlschema-instance"
                         xmlns:xsd="http://www.w3c.org/2016/XMLSchema"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Header>
</SOAP-ENV:Header>
<m:GetBookPrice
    xmlns:m="http://www.OrderBook.com/jw.book.pricelist">
<bookname xsl:type="xsd:string">MyWsBook</bookname>
</m:GetBookPrice>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

SOAP Response message using RPC based communication

<SOAP-ENV:Envelope xmlns:SOAP
                           ENV="http://schema.xmlsoap.org/soap/enveloper/"
                              xmlns:xsi="http://www.w3c.org/2016/XMLSchema-instance"
                              xmlns:xsd="http://www.w3c.org/2016/XMLSchema"
                          SOAP-ENV:encodingStyle=http://schemas.xmlsoap.org/soap/encoding/".
<SOAP-ENV:Header>
<SOAP-ENV:Header>
<SOAP-ENV:Body>
<m:GetBookPriceResponse
           Xmlns:m="http://www.OrderBook.com/jws.book.priceList">
 <Price>230.oo</Pirce>
<m:GetBookPriceResponse>
<SOAP-ENV:Body>
</SOAP-ENV:Envelope>


SOAP-HTTP

SOAP request using HTTP Based Communication:

POST/GetBookPrice HTTP/1.1
User-Agent:mozilla/5.0
Host:localhost:8080
Content-type:text/xml;charset="utf-8"
Content-length;546
SOAPAction:"/GetBookPrice

<SOAP-ENV;Envelope
Xmlns:SOAP-ENC="http://Schemas.xmlsoap.org/soap.org/soap/encoding/"
Xmlns:SOAP-ENV="http://Schemas.xmlsoap.org/soap.org/soap/envelope/"
  xmlns:xsl="http://www.w3c.org/2016/xmlschema-instance
xmlns:xsd="http://www.w3c.org/2016/xmlschema"
SOAP-ENV:encodingStyle=http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-env:Body>
</m:GetBookPriceXmlns:m=http://www.OrderBook.com/jws.book.priceList">
<bookname xsi:type="xsd:string">MyWsBook</bookname>
</m:GetBookPrice>
</SOAP-ENV:BODY>
</SOAP-ENV:Envelope>

SOAP Response using HTTP Based Communication:

HTTP/1.1 200 OK
Connection: Close
Content-length:534
Content-type:text/xml;charset="utf-8"
Date: sun,24 2016 10:34:38 GMT
Server:tomcat 6.0
<SOAP-ENV: Envelope
Xmlns:SOAP-ENV="http://Schemas.xmlsoap.org/soap.org/soap/enveloper/"
Xmlns:SOAP-ENC="http://Schemas.xmlsoap.org/soap.org/soap/encoding/">
 xmlns:xsl="http://www.w3c.org/2016/xmlschema-instance"
xmlns="http://www.w3c.org/2016/xmlschema"
SOAP-ENV:encodingStyle=http://schemas.xmlsoap.org/soap/encoding/">

</SOAP-ENV:BODY>
<m:GetBookPriceResponse
xmlns:http://www.OrderBook.com/jws.book.priceList>
<Result>500.00</Result>
</m:GetBookPriceResponse>
</SOAP-ENV:BODY>
</SOAP-ENV:Envelope>




No comments:

Post a Comment

High Paying Jobs after Learning Python

Everyone knows Python is one of the most demand Programming Language. It is a computer programming language to build web applications and sc...