Document style SOAP Services

The SOAP <Body> contains an XML document fragment in the document-style of messaging. Its never reflect any XML structure. The run-time SOAP environment abstracts the SOAP <Body> element as it stands and hands it over to the application it is destined for unchanged. It’s sometimes associated to be a response message. Document Style also known as document-oriented or message-oriented style.  Document oriented style provides a lower layer of abstraction. In this style needs more programming work.

The SOAP Header is optional.

  • The children of the SOAP header are called header blocks. Each header block represents a logical grouping of data.
  • The SOAP Body is a mandatory element within a SOAP message. The end-to-end information conveyed in a SOAP message is carried here.
  • The choice of what data is placed in a header block and what data goes in the SOAP Body element are decisions that are taken at the time that an application is designed.

Working With Document Style SOAP Messages

Oracle Application Server Web Services supports two types of SOAP message exchanges

1)      RPC Style exchanges

2)      Document-Style exchanges.

  • Document-style exchanges, also called message-oriented exchanges, model exchanges where

1)      XML documents are exchanged

2)      The exchange patterns are defined in the sending and the receiving applications.

  • In the Document Style messages, SOAP places no constraints on how the document sent in the SOAP message body is structured, the application, or an externally specified XML schema determines the structure of the XML document that is sent in the body of the SOAP message.
  • Message-oriented information exchange supports organizations and applications that need to exchange business or other types of documents where a message is sent but the sender may not expect or wait for an immediate response.
  • Message-oriented information exchange is also called Document style SOAP message exchange. Document -style messages model exchanges where XML documents are exchanged, where the semantics of the exchange patterns are defined in the sending and the receiving applications.

 

Below example is a sample Document Style SOAP message that is sent from a client to an Oracle Application Server Web Services document style service. The client sends an XML document that contains employee records with elements including name, emp_id, department, and contact information. A web service that processes this XML document to produce a phone listing may supply an XML document that contains only the name and phone number elements.

 

Eg: -Document Style SOAP Message

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<organisation>
<employee>
<name>Bob</name>
<emp_id>1234</emp_id>
<department>hr</department>
<contact>
<phone>827 644 5674</phone>
<email>bob@organisation.com</email>
</contact>
</employee>
<employee>
<name>Susan</name>
<emp_id>2434</emp_id>
<department>it</department>
<contact>
<phone>827 644 5674</phone>
<email>Susan@organisation.com</email>
</contact>
</employee>
</organisation>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Example -Document Style SOAP Message Processed by a Web Service

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<employee>
<name>Bob</name>
<phone>827 644 5674</phone>
<name>Susan</name>
<phone>827 644 5674</phone>
</employee>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>