Reputation: 295
I'm trying to follow this example and the goal is to set SOAP Header.
So far my code looks like this:
SomethingPortType portType = service.getPort(SomethingPortType.class);
Map<String, Object> requestHeaders = new HashMap<String, Object>();
requestHeaders.put("MyHeader1", "This is a string value");
requestHeaders.put("MyHeader2", "This is a string value2");
// Set the Map as a property on the RequestContext.
BindingProvider bp = (BindingProvider) portType;
bp.getRequestContext().put("???", requestHeaders);
I'm not using any application server, how to figure out what I should put in place of ??? (or com.ibm.websphere.webservices.Constants.REQUEST_TRANSPORT_PROPERTIES from example) to set SOAP Header properly?
Upvotes: 1
Views: 6558
Reputation: 295
In short, I was missing this line:
bp.getRequestContext().put(MessageContext.HTTP_REQUEST_HEADERS, requestHeaders);
Upvotes: 1