Encoding requests and responses (DataStage)
Simple Object Access Control (SOAP) is a messaging framework for exchanging information between applications and web services. When SOAP is used, web service requests and responses are encoded in Extensible Markup Language (XML), a well-established text-based standard. XML elements and attributes identify the data that is exchanged between the web service and IBM® DataStage®. Using an XML schema, the web service stipulates which data is needed for the exchange.
Sample request and response
Consider the following request and response. The requester application queries a web service with a company name, Samples Outdoor Company. The web service returns an address block.
Request
<?xml version="1.0"?>
<Address>
<getAddress>
<name>Samples Outdoor Company</name>
</getAddress>
<Address>
Response
<xml version="1.0"?>
<Address>
<getAddressResponse>
<number>50</number>
<street>Washington</street>
<city>Westborough</city>
<state>MA</state>
<zip>01581</zip>
</getAddressResponse>
</Address>
Using the SOAP framework
Published by the World Wide Web Consortium (W3C), the SOAP specification describes the following items:
- Structure of SOAP messages, which includes the requests, responses, and other information.
- Rules for encoding data types as XML, from simple data types, such as strings and
integers, to complex data types, such as classes and structures. In a SOAP message, the
encodingStyle
attribute identifies the URI that supplies the encoding rules. - Conventions for invoking remote procedure calls (RPCs), from a requester application and a web service. The Web Service stage supports RPC-style and document-style communication with a web service.
- Binding of SOAP to transport protocols, such as HTTP and SMTP.

The SOAP envelope is a wrapper element that identifies the subordinate elements as a SOAP message and provides namespace declarations. Namespaces provide semantic context for elements within the SOAP body.
The SOAP header is an optional element that can contain metadata, such as authentication information, localization support, and delivery routes.
The SOAP body contains the payload of the message, which is either the web service request or web service response. The response can be a processing error, which is called a SOAP fault.
Requests that are incorporated within a SOAP message
Following is a sample request that is incorporated within a SOAP message. Major
elements such as the <SOAP-ENV:Body>
are highlighted.
<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"
xmlns:auth="http://schemas.xmlsoap.org/ws/2002/04/secext"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Header>
<auth:Security>
<auth:UsernameToken>
<auth:Username>Smith</auth:Username>
<auth:Password>XMLER</auth:Password>
</auth:UsernameToken>
</auth:Security>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns:getAddress xmlns:ns="PhoneNumber">
<name xsi:type="xsd:string"> Samples Outdoor Company </name>
</ns:getAddress>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>