WebSphere

Accessing SOAP header information in the SMO

You can access SOAP header information from messages received from a Web services import.

Introduction

Messages received from a Web services import might include SOAP headers from the original SOAP message. The SOAP headers are placed in the headers section of the service message object (SMO): in the /headers/SOAPHeader element, which can have zero or more occurrences. A SOAPHeader element is a wrapper that contains the original SOAP header as its value element. The XML namespace-qualified name of the SOAP header type appears in the name and nameSpace elements of the SOAPHeader .

SDO paths for accessing SOAP headers in custom mediations

In a Custom Mediation primitive, you can use the SDO API to access SOAP header content.
  • To access all SOAP headers present in the SMO:
    import commonj.sdo.DataObject;
    import java.util.List;
    
    DataObject smo = ...
    List soapHeaders = smo.getList ("/headers/SOAPHeader");
    Iterator it = soapHeaders.iterator ();
    
    
    while (it.hasNext ())
    {
    	DataObject wrapper = (DataObject) it.next ();
    	Object header = wrapper.get ("value");
    
    	// do something with the header
    }
    The list of SOAP headers might be an empty list.
  • To access a SOAP header with a particular name (global element or type name):
    import commonj.sdo.DataObject;
    import java.util.List;
    
    String headerName = ...
    DataObject smo = ...
    Object header = smo.get ("/headers/SOAPHeader[name='" + headerName + "']/value");
The header value in these two cases is a DataObject unless defined as a simple type, in which case it is a Java™ object of corresponding primitive type. For example, Integer or String. The properties of the DataObject correspond to the structure defined by the XML schema, or the WSDL description of the header.

Conditions under which SOAP headers are present in a request flow

SOAP headers appear in the SMO in a request flow if all the following conditions are true:
  • The message has been received from a Web service import.
  • The sending application included SOAP headers when creating the original request.
  • An XML schema or WSDL description of the header structures is present in the mediation module, or associated library.
Exceptions to these conditions are:
  • If the SOAP binding used by the client maps WSDL message parts to SOAP headers, the corresponding content appears in the SMO body rather than in the SOAPHeader element.
  • WS-Addressing headers are processed by the mediation infrastructure and do not appear in the SMO.

reference Reference topic

Terms of use | Feedback


Timestamp icon Last updated: 20 June 2010 00:40:01 BST (DRAFT)


http://publib.boulder.ibm.com/infocenter/dmndhelp/v6r2mx/topic//com.ibm.wbit.help.medprim620.doc/ref/rwesb_SMOandSOAP.html
Copyright IBM Corporation 2005, 2010. All Rights Reserved.
This information center is powered by Eclipse technology (http://www.eclipse.org).
iDoc on