How does Simple Object Access Protocol (SOAP) help in Internet Communication


Simple Object Access Protocol (SOAP) is a rich protocol, which is language and platform independent used mainly for interoperability of applications across the web. It is rich due to the fact that the protocol specification is based on XML (eXtensible Markup Language) and thus utilizes the powerful features of XML for the data communication over HTTP. The SOAP specification is currently maintained by the World Wide Web Consortium (W3C).

The main reason for the design of SOAP by Microsoft was to facilitate the utilization of the web services provided by one application for use by another, irrespective of the object model, operating system or language in which both the applications are created. With this, a widely distributed, complex computing environment can be created leveraging on the existing internet infrastructure. SOAP enables component based services over the Internet so that Web services are available for a wide range of users achieving code re-use using “Black box” techniques.

Unlike other RPC (Remote Procedure Call) protocols like DCOM, CORBA, etc. which are object model specific and not compatible with internet, SOAP is based on XML using HTTP protocol which is supported by all browsers and servers. Although SMTP is also a valid protocol layer for SOAP, it is often used with HTTP as a protocol layer making it easier to communicate through firewalls and proxies. To understand the simplicity of SOAP, it is better to know about how it works:

SOAP message structure

Similar to a HTTP message packet that has its own message format maintained for communication, a SOAP message has the following sections:

• Envelope : to identify that the XML document is a SOAP message (mandatory)
• Header: to carry the header information (optional)
• Body : for holding the request and response information (mandatory)
• Fault : for holding error and status information. (optional)

Communication using SOAP

The three main components involved in the SOAP communication over the internet are as below:

• SOAP client
• SOAP server
• Service provider

The SOAP client sends a SOAP request similar to that of below sample over HTTP through the internet. The SOAP server recognizes the request as a SOAP request and routes to its service manager (after checking whether the service is listed in the server), which then forwards it to the XML Translator. This XML translator decodes the method (service) to be invoked on the COM component (or the Java bean) and translates the result back to XML format to be sent as response. Thus, a high level of encapsulation of implementation of the service is achieved which makes it easier for applications to be interoperable.

Sample SOAP Request

<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<req:echo xmlns:req="http://localhost:8080/SOAPsample/services/MyService/">
<req:category>Catalogue</req:category>
</req:echo>
</soapenv:Body>
</soapenv:Envelope>

Sample SOAP Response

<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<wsa:ReplyTo>
<wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
</wsa:Address>
</wsa:ReplyTo>
<wsa:From>
<wsa:Address>http://localhost:8080/SOAPSample/services/MyService</wsa:Address>
</wsa:From>
<wsa:MessageID>ACA6C4F298F30E39CD22544016773147</wsa:MessageID>
</soapenv:Header>
<soapenv:Body>
<req:echo xmlns:req="http://localhost:8080/SOAPSample/services/MyService/">
<req:category>Catalogue</req:category>
</req:echo>
</soapenv:Body>
</soapenv:Envelope>

The main limitation of SOAP is that due to its verbose XML data, the performance can be a drawback in cases where bulk data has to be transmitted. It is suggested to use MTOM (Message Transmission Optimization Mechanism) concepts to embed binary objects in messages in such cases.

In its simple and versatile nature of development, SOAP has provided a facility to achieve interoperability among widely distributed web based enterprise applications cutting down the development time, cost, and leveraging on existing applications and resources.

|Designing applications in .Net using Service Oriented Architecture | How to Create and Use Anonymous Delegates in C# (C Sharp) |How to Define Custom Attributes in C# (C Sharp)| How To Handle Errors While Developing ASP.NET Applications | How to Use Indexer in Classes and Interfaces of C# (C Sharp)| Illustration of Access Keywords (base, this) with Examples in C# (C Sharp) | Illustration of Null Coalesce Operator (??) in C# (C Sharp) |Indexers Vs Properties in C# (C Sharp) | More about Reserved Attributes of C# (C Sharp)| Overview of Unified Type System of C# (C Sharp) | Purpose of Delegates in C# (C Sharp) |How does Simple Object Access Protocol (SOAP) help in Internet Communication |How to Create and Use Anonymous Delegates in C# (C Sharp)|

 


“Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.”

| Privacy Policy for www.dotnet-guide.com | Disclosure | Contact |

Copyright - © 2004 - 2024 - All Rights Reserved.