Skip to main content

Setting a request context

To set a particular request context property, ContextPropertyName , to the value, PropertyValue , use the code shown in the below example.

Setting a Request Context Property on the Client Side

// Set request context property.
java.util.Map<String, Object> requestContext =
   ((javax.xml.ws.BindingProvider)port).getRequestContext();
requestContext.put(ContextPropertyName, PropertyValue);

// Invoke an operation.
port.SomeOperation();

You have to cast the port object to javax.xml.ws.BindingProvider in order to access the request context. The request context itself is of type, java.util.Map<String, Object> , which is a hash map that has keys of String and values of arbitrary type. Use java.util.Map.put() to create a new entry in the hash map.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!