How do you set a custom HTTP header (not SOAP header) dynamically on the client side when using Spring-WS?
When using spring integration 3 and spring integration-ws, the following code can be used for handling the request:
public boolean handleRequest(MessageContext messageContext)
throws WebServiceClientException {
TransportContext context = TransportContextHolder.getTransportContext();
HttpUrlConnection connection = (HttpUrlConnection) context
.getConnection();
connection.getConnection().addRequestProperty("HEADERNAME",
"HEADERVALUE");
return true;
}
The Interceptor can be connected to the outbound gateway in the following way: