Setting a request context - 7.3

Talend ESB Service Developer Guide

Version
7.3
Language
English
Product
Talend Data Fabric
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
Module
Talend ESB
Talend Runtime
Content
Design and Development
Installation and Upgrade
Last publication date
2023-04-17

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.