You can retrieve SOAP headers from a response message by
creating a variable of type SOAPHeaders and then
mapping that variable to the SOAP header response.
Before you begin
This task requires that you have access to an integration
service with a web service integration component and a SOAP request
message.
Procedure
-
Create a private variable:
- In Process Designer, create a service flow and add a service task.
- In the desktop Process Designer, create an
integration service that includes a web service integration component.
-
Create a private variable of the type SOAPHeaders.
This variable will receive the header entries from the SOAP response message.
- On the Data Mapping tab of the Properties
view, in the Output Header Mapping section, map your newly created
variable to the response SOAP header.
When the web service
invocation finishes, this variable is initialized for you and it contains
all the SOAP header entries from the SOAP response message.
- To access the headers that have been received by the variable,
add JavaScript code to Post-execution
Assignments on the Pre & Post tab
or add a server script component after the web service integration
component and add the code there.
The following example
shows how to access the header entries. In this example, the private
variable
tw.local.responseHeaders is defined
on the
Variables tab and mapped to the response
SOAP header on the
Data Mapping tab.
var myHeader = new tw.object.SOAPHeader();
var numHeaders = tw.local.responseHeaders.headers.listLength();
for (var i = 0; i < numHeaders; i++) {
if (tw.local.responseHeaders.headers[i].name == "header1") {
myHeader = tw.local.responseHeaders.headers[i];
}
}
- Complete the definition of the web service integration.
- Click Save or Finish
Editing.
-
Run the service flow or integration service by clicking
Run Service and verify that the SOAP headers are added to the request message
and that the expected SOAP headers are retrieved from the response SOAP message.