Setting and Reading HTTP Header Variables
Usage
You can transfer additional header information, e.g. a session ID, to a calling web service via a variable. These additional header information are inserted into the HTTP request header and sent to the web service called.
The HTTP response headers set in the response message are written to a variable.
The incoming HTTP headers at a Web Service Listener Connector are written to a variable.
To set your own HTTP headers in the response message created by the listener connector you can set a variable slated for them in the workflow.
Setting HTTP Header Variable for a Web Service Call
You can set HTTP header information via the following XML variables of the is:anyElement
type.
For the outgoing request, you define the WSCaller.requestHeaders
variable and its contents is inserted to the HTTP headers.
The variable is to be structured as follows.
Variant 1
<RequestHeaders>
<x-test>Request header set at Web Service Connector</x-test>
</RequestHeaders>
Variant 2
<RequestHeaders>
<Header name="x-test">
Request header set at Web Service Connector
</Header>
</RequestHeaders>
The header information are taken form the child element of the root element RequestHeaders
.
The header name is taken from the name
attribute (if available) or from the element name.
The header value results from the element content.
Reading the HTTP Header after a Web Service Call Using a Web Services Connector
The HTTP header at a calling Web Services Medium/Output Connector is written as an XML structure to the WSCaller.responseHeaders
variable as follows:
<ResponseHeaders>
<Transfer-encoding>chunked</Transfer-encoding>
<Content-type>text/xml;charset=utf-8</Content-type>
<Server>Apache</Server>
<Date>Mon, 16 Apr 2012 06:07:11 GMT</Date>
<Vary>Accept-Encoding</Vary>
<X-test>Test</X-test>
</ResponseHeaders>
Variable for HTTP Header of a Listeners’ Input Message
The HTTP headers of an incoming web service call at a Web Service Listener are written as an XML structure to the WSListener.requestHeaders
variable as follows:
<RequestHeaders>
<Cache-control>no-cache</Cache-control>
<Host>localhost:8000</Host>
<Content-type>text/xml;charset=utf-8</Content-type>
<Content-length>324</Content-length>
<Connection>keep-alive</Connection>
<Pragma>no-cache</Pragma>
<Authorization>(removed)</Authorization>
<X-test>Test</X-test>
<User-agent>JAX-WS RI 2.2-hudson-752-</User-agent>
<Accept>text/xml, multipart/related</Accept>
<Soapaction>"testOperation"</Soapaction>
</RequestHeaders>
Setting the HTTP Header for an Outgoing Response Message
To set your own HTTP header for the Web-Services (Listener) response use the WSListener.responseHeaders
variable.
The structure corresponds to the one of the WSCaller.requestHeaders
variable (root element ResponseHeaders
).
Example
<ResponseHeaders>
<Transfer-encoding>chunked</Transfer-encoding>
<Content-type>text/xml;charset=utf-8</Content-type>
<Server>Apache</Server>
<Date>Mon, 18 Jan 2016 06:07:11 GMT</Date>
<Vary>Accept-Encoding</Vary>
<X-test>Test</X-test>
</ResponseHeaders>