What is SOAP Web Service ?

 

SOAP stands for Simple Object Access Protocol which used XML format to communicate between two systems. This service can interact or talk with remote system using XML messages. SOAP is a W3C recommendation for building web services. This is platform independent as well as language independent.

Example : Server is running SOAP service using .Net technology and our client is java client. So in this case our client and server will talk using XML message and independent of technologies they are using. Client application is just concerned about SOAP messages which it can understand. Our client is fine till the point server is returning SOAP messages.

 

SOAP Web Service

 

Sample Request

<?xml version="1.0"?>

<soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope/"
soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding">

<soap:Body>
<m:GetName xmlns:m="http://www.websphereportal.org/name">
<m:Item>123456</m:Item>
</m:GetName>
</soap:Body>

</soap:Envelope>

As you can see we are sending some data to server like item number based on which it will return price of this item. This is input which we have to provide to get output from soap web service. 

Sample Response

<?xml version="1.0"?>

<soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope/"
soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding">

<soap:Body>
<m:GetNameResponse xmlns:m="http://www.websphereportal.org/name">
<m:Price>100</m:Price>
</m:GetNameResponse>
</soap:Body>

</soap:Envelope>

As you can see we are receiving response from server  inside price tag which is price for the item. Now we can use this result in our application to process information.

 

SOAP web Services are very common in today’s website architectures or I will say most important part which makes system more flexible and non cohesive. You can call this web service from your java code or .Net code and you can retrieve data from remote system. Then you can process this message to retrieve data and show it on your website or portal. This is advanced concept for college level students but easy to understand and implement as well. We will discuss about other types of web services and web servers in our coming posts.