LogoASPAlliance: Articles, reviews, and samples for .NET Developers
An Introduction to Simple Object Access Protocol
by Joydip Kanjilal
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 52228/ 84


Simple Object Oriented Protocol or SOAP is a simple, light weight, XML based protocol that can be used for exchange of data in a de-centralized, distributed environment.  It is making headlines these days within the enterprise development community and promises to revolutionize Web applications development by facilitating interoperability between heterogeneous applications.  Using the SOAP protocol, objects of any kind, developed on any platform, using any language can cross communicate with each other.  Hence, we can connect the services offered by different heterogeneous systems together as components and use these components to build a complex information system with ease.  This article provides a detailed overview of SOAP in a lucid language.

What is SOAP, Anyway?

Simple Object Oriented Protocol or SOAP is a stateless, platform independent, XML based generic lightweight protocol that used HTTP as its transport and can be used for developing distributed complex computing environments.  SOAP is about applications communicating directly with each other over the Internet in a very rich way.  It is a stateless, message exchange paradigm that allows for exchange of data between heterogeneous web applications.  SOAP is supported on any platform and be utilized on a wide variety of applications.  SOAP is similar to its contemporary technologies, like DCOM or CORBA, in the sense that both provide a RPC mechanism for invoking remote methods.  However, SOAP differs from these technologies in the XML Open Standard that it provides for the purpose of data exchange between homogenous or heterogeneous distributed applications.  SOAP is supported by both HTTP and SMTP, but HTTP gained more acceptances over the years.

SOAP is platform independent, language independent and messaging between applications makes this protocol a robust and standardized mechanism in order to handle message communication across homogenous or heterogeneous networks.  The most common messaging pattern used in SOAP is Remote Procedure Call or RPC.  This indicates that the client sends a request message to the server.  The server in turn sends the response message to the client.  The prerequisite for having a proper understanding of SOAP is XML.  This is because XML is the basis of all SOAP related activities.  All SOAP messages are transmitted in XML format.  XML, a platform independent Meta (Language composed of non-binary ASCII text), has revolutionized the way data is transferred between systems.  XML is fast becoming as ubiquitous as HTTP.  It has now already become an accepted standard for representation and interchange of data in structured form accross systems.  All SOAP messages are transmitted as XML.

Why is SOAP required?

Distributed Applications that can support heterogeneous platforms for the purpose of data and information requires a common data format for transmission of data.  We have had protocols earlier like DCOM, RPC, IIOP, etc, but these were restricted to a homogenous environment only. They have been around for quite some time now, but they have their own limitations.  Any two systems communicating with each other using any of these protocols should have support for the protocol that they are using.  As an example, if a system "A" communicates with a system "B" using IIOP, both these systems should have support for IIOP to ensure that the communication takes place successfully.  For a heterogeneous environment this is not feasible.  The situation is more complex.  Simple Object Oriented Protocol (SOAP) is an Open Standard protocol and the solution to this complexity.

Advantages of SOAP

The following are some of the many advantages that SOAP provides.

·         Simplicity -- The SOAP messages are in simple, human readable XML format.

·         Scalability -- This is because it uses HTTP protocol for transport.

·         Language neutrality -- Can be developed using any language.

·         Interoperability and Platform Independence-- SOAP can be implemented in any language and can be executed in any platform.

Disadvantages of SOAP

The following are the disadvantages of SOAP.

·         Slower than CORBA or RMI or IIOP due to the lengthy XML format that it has to follow and the parsing of the envelop that is required.

·         It depends on WSDL and does not have any standardized mechanism for dynamic discovery of the services.

Composition of SOAP

As per the SOAP specification, SOAP is typically composed of the following three parts:

·         A framework that describes how the message can be constructed and how it can be processed

·         A set of encoding rules for exchanging the data types

·         A convention and a procedure for representing the Remote Procedure Calls

Anatomy of a SOAP Message

A client sends a SOAP message to the server.  This requesting data is also called a SOAP Request. The server receives the request, processes the same and sends a response back to the client. This returning data is known as the SOAP Response.  This communication back and forth between the client and the server takes place through HTTP protocol.

The following constitute a SOAP message declaration:

·         An envelope element that recognizes then XML file format which will be sent across as a SOAP message

·         An optional element that can describes header information

·         The description of the body which contains the information of the request and the response elements

·         Provision for another optional element that provides information as and when an error occurs

The SOAP format is clearly illustrated in listing 1 that follows.

Listing 1: A SOAP message format

<SOAP: Envelope>
  <SOAP: Header>
  </SOAP: Header>
  <SOAP: Body>
  </SOAP: Body>
</SOAP: Envelope>
SOAP support in Microsoft .NET

This section discusses the support for SOAP that is provided by the Microsoft .NET Framework. Microsoft .NET provides an excellent inbuilt support for SOAP.  This section discusses the SOAP support that is available in Microsoft .NET for both Web Services and Remoting technologies.

SOAP and Web Services

Simple Object Access Protocol (SOAP), Web Services Description Language (WSDL), and Universal Description, Discovery and Integration (UDDI) are emerging as the de facto standards for Web services.  A Web Service can be consumed by any client irrespective of the platform that the client is using.  This is because Web Services are based on the HTTP protocol.  The .NET Framework encapsulates the support for SOAP internally.

SOAP and Microsoft .NET Remoting

Unlike Web Services, Remoting is a technology that can be used in homogenous environments only.  Remoting technology uses channels and formatters.  The channels provide the transport protocol and the formatters are responsible for serialization and de-serialization.  We can create SOAP channels rather than using the HTTP channels in .NET.  In such a case, we have to make use of the System.Runtime.Serialization.Formatters.Soap namespace in .NET.


It should be noted that SOAP does not address object activation, marshaling objects/references, garbage collection, etc.  Further, as SOAP is a wire protocol, it does not provide an activation mechanism.  However, we can still use these in our applications as a layer on top of SOAP if required.  This article has provided a detailed discussion on SOAP, why SOAP is required, the advantages and disadvantages of SOAP and the support for SOAP in Web Services and Microsoft .NET Remoting technologies.

Product Spotlight
Product Spotlight 

©Copyright 1998-2021  |  Page Processed at 2021-11-29 1:37:11 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search