You can set the REQUEST_TRANSPORT_PROPERTIES property and RESPONSE_TRANSPORT_PROPERTIES property on a Java API for XML-based RPC (JAX-RPC) client Stub, a Call instance, or a Java API for XML-Based Web Services (JAX-WS) BindingProvider instance to enable a Web services client to send or retrieve transport headers.
Transport headers that require multiple values
name1=value1;name2=value2;name3=value3
HashMap values
In this case, the name=value from the HashMap is silently ignored, preventing a client from overwriting or modifying values for the name value that are already set in the outgoing request header by either the server or the Web services engine.
When the HashMap header value contains multiple name values, the first occurrence of the name value is used and the others are silently ignored. For example, if the HashMap header value contains name1=value1;name2=value2;name1=value3, where there are two occurrences of name1, the first value, name1=value1, is used. The other value, name1=value3, is silently ignored.
HashMap values
Only the HashMap keys are used; the HashMap values are ignored. The values are filled in this HashMap by retrieving the transport headers, which correspond to the HashMap keys from the incoming response message. An empty HashMap causes all of the transport headers and the associated values to be retrieved from the incoming response message.
The following are HTTP headers that are given special consideration when sending and retrieving HTTP responses and requests.
The values in these headers can be set in a variety of ways. For example, some header values are sent based on settings in a deployment descriptor or binding file. In these cases, the value set through REQUEST_TRANSPORT_PROPERTIES overrides the values set any other way.
Header | Send request | Retrieve response |
Transfer-encoding |
|
There is no special processing. |
Connection |
|
There is no special processing. |
Expect |
|
There is no special processing. |
Host | Ignored | There is no special processing. |
Content-type | Ignored | There is no special processing. |
SOAPAction | Ignored | There is no special processing. |
Content-length | Ignored | There is no special processing. |
Cookie The following is a String constant: com.ibm.websphere.webservices.Constants.HTTP_HEADER_COOKIE |
The value is sent on the header if it is structured correctly. See the information in this article for Header value format and HashMap values. | There is no special processing. |
Cookie2 The following is a String constant: com.ibm.websphere.webservices.Constants.HTTP_HEADER_COOKIE2 |
See the information in the "Cookie" entry. | There is no special processing. |
Set-cookie The following is a String constant: com.ibm.websphere.webservices.Constants.HTTP_HEADER_SET_COOKIE |
There is no special processing. | If the property MAINTAIN_SESSION is set to true, the entire value is saved into SessionContext.CONTEXT_PROPERTY and is sent on subsequent requests in the Cookie header. See the Cookie entry in this table for more information. |
Set-cookie2 The following is a String constant: com.ibm.websphere.webservices.Constants.HTTP_HEADER_SET_COOKIE2 |
There is no special processing. | If the property MAINTAIN_SESSION is set to true, the entire value is saved into SessionContext.CONTEXT_PROPERTY and is sent on subsequent requests in the Cookie header. See the Cookie entry in this table for more information. |
HashMap sendTransportHeaders=new HashMap(); sendTransportHeaders.put("Cookie","ClientAuthenticationToken=FFEEBCC"); sendTransportHeaders.put("MyRequestHeader","MyRequestHeaderValue"); ((Stub) portType)._setProperty(Constants.REQUEST_TRANSPORT_PROPERTIES, sendTransportHeaders); HashMap receiveTransportHeaders=new HashMap(); receiveTransportHeaders.put("Set-Cookie", null); receiveTransportHeaders.put("MyResponseHeader", null); ((Stub) portType)._setProperty(Constants.RESPONSE_TRANSPORT_PROPERTIES, receiveTransportHeaders); resultString=portType.echoString("Foo");