SOAP XML Message – Understanding and Creating with Liquid XML Studio

Filed Under: Java

What Is SOAP?

Soap is an XML based transport protocol. Soap stands for Simple Object Access Protocol. Soap is a lightweight mechanism for exchanging structured and typed information. As it is XML based so it is language and platform independent. SOAP has been a widely accepted protocol for XML based system- to- system communications so several web services rely on SOAP.

SOAP has the following Elements:

  • Envelope
  • Header
  • Body
  • Fault

SOAP Envelope:  You can consider Envelope as the Root Element in XML. It is configured to get notified that when the message transfer is over and when you need to stop receiving the message and process it. Just like XML Root is mandatory, Envelope is also a mandatory part of Soap. Every Envelope must contain one body Element in it. Inside the Envelope positions, all the elements are fixed and cannot be changed. The Element is prefixed by ENV Namespace.

An Envelope looks like this


<?xml version="1.0"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://www.w3.org/2001/12/soap-envelope"

SOAP-ENV:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
  ...
  Message information goes here
  ...
</SOAP-ENV:Envelope>

SOAP Header: Header in Element can exist multiple times in the soap. The header element will always be the first child of the Envelope. Header Elements are used to add new features and functionality in the soap. All the List Header Elements come after Envelope Start Element and Body Start Element. Header Element has the following two Attributes.

SOAP Body: Body is a mandatory part of a soap message. It contains the data which needs to be exchanged in a soap message. The body should be inside an Envelope and below a Header. Soap based web services can be implemented on IIS Server and then the Soap processor will map the body information to .net based objects.

SOAP Faults: For Error Handling Fault element is included in a soap message. This is also present inside Envelope and after a body element. Fault element has the following sub-elements.

  • Fault Code: This is an error code which details the type of error code that has been generated.
  • Fault String: small description about the error.
  • Fault Actor: Possible cause of error. This is useful when the service is served through many hope and it is intended that this will tell you which hope had created the error.
  • Details: Detailed description of error caused.

To create a SOAP Message for SOAP-based web service from the Liquid XML Editor is very easy to do, here’s how;

Step 1: Download the Liquid Xml Editor from here and install.

Step 2: Create a new project.

Step 3: Right click on documents Add a new item.

 Step 4: Now click on icon which says Call A Webservice.

Step 5: Provide the webservice URL and click on Test.

Step 6: Once the test is successful, click on New .

Step 7: A list of soap methods is displayed.

Step 8: Click on any of the methods for which you need to create SOAP-based XML.

Step 9: Now click Finish to complete the operation.

SOAP will be generated for your operation.

Comments

  1. Nitin Shende says:

    Hi Pankaj,

    Very good tutorial, but I am looking for how to parse soap-xml document in java.
    Can you please explain that ?

    Thanks,
    Nitin

    1. Pankaj says:

      Hi Nitin,

      You can use any java parsers to parse the Soap XML document because ultimately it’s an XML document. I would suggest you to go through java xml tutorial.

Leave a Reply

Your email address will not be published. Required fields are marked *

close
Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages