Introduction to SOAP based Web Services

SOAP is a Simple Object Access Protocol, which decides the format in which the data is to be sent and received across different systems. Communication between the web service and client happens using XML messages. SOAP defines the rules for communication like what tags should be used in the XML and the special meanings they denote. A SOAP based service often contains a WSDL to describe the interface that a Web Service offers. We will be going into more details ahead. Also, there are some more Web Service terminologies that we will be learning, apart from those which we had already done in our previous article on Introduction to Web Services.

If you have a Java Implementation class and some other ‘Consumer’ class wants to access one of it’s method, the best way is to provide an interface to the ‘Consumer’ class. Consider the same scenario, where instead of an Java implementation class I have a Web Service. I don’t know what technology the ‘Consumer’ class is based on, maybe C++ or .Net, but I know that the Web Service is a Java Web Service. The best possible way now is to provide an interface that is understandable on both the sides or should be technology independent. Right? Definitely, the standard format can be none other than an XML. So, the Web Service provides a Web Service document or a WSDL, to the Consumer class, which is very similar to what an Interface does, specifying the methods, arguments, the return types, Web Service location and so on.

SEI(Service Endpoint Interface) is an interface to the Web Service Endpoint, at the client application, which translates the complete Web Service call to a SOAP message. It can be generated within the client application, and hence is specific to the technology in which we are developing . So a Java SEI knows how to convert a Java object to a SOAP message. Similarly, a C++ SEI knows how to convert a C++ object to a SOAP message. Once we have the SEI generated out of WSDL, we do not actually need to worry about the Web Service end. It handles all Web Service complexities by the call of one of it’s method.

We have talked enough about a SOAP message, let’s see how a SOAP message structure looks like:

SOAP Message Structure

SOAP Message elements:

  1. Envelope: Identifies the XML document as a SOAP message.
  2. Header: Contains the header information.
  3. Body: Contains XML content or a SOAP Fault, which provides information on error occurred in processing the web service.

Example SOAP Message:

I hope things are much clear for you on Web Services. We will try creating an actual SOAP Service Application in the upcoming article. Concerns and queries are welcome.

Receive our updates to your inbox

Get more stuff like this
in your inbox

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.