Receiving implicit SOAP headers with JAX-RPC

You can enable an existing Java API for XML-based RPC (JAX-RPC) Web services client to receive values from implicit SOAP headers. By modifying your client code to receive implicit SOAP headers, you can receive specific information within an incoming web service response.

Before you begin

To complete this task, you need a web services client that you can enable to receive implicit SOAP headers.

An implicit SOAP header is a SOAP header that fits one of the following descriptions:
  • A message part that is declared as a SOAP header in the binding in the Web Services Description Language (WSDL) file, but the message definition is not referenced by a portType element within a WSDL file.
  • An element that is not contained in the WSDL file.

Handlers and service endpoints can manipulate implicit or explicit SOAP headers using the SOAP with Attachments API for Java (SAAJ) data model.

You cannot manipulate protected SOAP headers. A SOAP header that is declared protected by its owning component, for example, Web Services Security, is not accessible to client applications. An exception occurs if you try to manipulate protected SOAP headers.

About this task

The client application sets properties on the Stub or Call object to send and receive implicit SOAP headers.

Procedure

  1. Create a java.util.HashMap object
  2. Add an entry to the HashMap object for each implicit SOAP header that the client wants to receive. The HashMap entry key is the QName of the SOAP header. The HashMap entry value is null.
  3. Set the HashMap entry on the Stub or Call object. The property name is com.ibm.websphere.webservices.Constants.RESPONSE_SOAP_HEADERS. The value of the property is the HashMap.
  4. Issue remote method calls against the Stub or Call object. The web services engine extracts the specified response headers from the web services response message and inserts them into the HashMap. After the remote method returns, the response headers are accessible from the HashMap object.
    A JAXRPCException error can occur if any of the following are true:
    • The HashMap contains a key that is not a QName.
    • The HashMap contains a key that represents a SOAP header that is declared protected by the owning component.

Results

You have a JAX-RPC web services client that can receive values from implicit SOAP headers.




In this information ...


IBM Redbooks, demos, education, and more

(Index)

Use IBM Suggests to retrieve related content from ibm.com and beyond, identified for your convenience.

This feature requires Internet access.

Task topic Task topic    

Terms of Use | Feedback

Last updatedLast updated: Sep 19, 2011 7:16:32 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=matt&product=was-express-iseries&topic=twbs_retrievesoaphead
File name: twbs_retrievesoaphead.html