+

Search Tips   |   Advanced Search

 

Receiving values from implicit SOAP headers

 

You can enable an existing 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. To complete this task, we 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:

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.

 

Overview

The client application sets properties on the Stub or Call object to send and receive implicit SOAP headers. You can modify the client code as follows:

 

Procedure

  1. Create a java.util.HashMap.

  2. Add an entry to the HashMap 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.A JAXRPCException 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 Web service client that is able to receive values from implicit SOAP headers.



Sending values in implicit SOAP headers
Implementing extensions to the JAX-RPC and Web Services for J2EE client programming models

 

Related Reference


Example: Using SOAP headers within a Web services request and response

 

Related information


SOAP with Attachments API for Java interface