Recently I worked on a scenario with two Idocs that are used as asynchronous request and response messages for ERP and a synchronous webservice.
For this scenario, I used SOAP adapter with async-sync brigde with help of RequestResponseBean and ResponseOnewayBean.
I wanted to populate fields in the response Idoc from the request Idoc. Here I had the challenge that the required values were only available in the Idocs, but not part of the request and response message of the web service, so I could not use the option with GetPayloadValueBean and PutPayloadValueBean, as it is described in this blog of Beena Thekdi:
I wanted to use the dynamical header fields of the PI message to store the vales. Unfortunately, the SOAP adapter removes dynamic header field from request message, so the response message would not be able to access them. So I needed to find a way to keep the values.
I found the solution with the DynamicConfigurationBean that allows copying values form dynamical header fields to the module context and back. All adapter modules within the same module chain of the communication channel can access the parameter values in the module context.
I have already described this feature in this blog:
Unknown use case of DynamicConfigurationBean: Store file name to JMS header without mapping
Now the module chain of my SOAP adapter receiver channel looks like this:
Module | Type | Module Key |
---|---|---|
AF_Modules/DynamicConfigurationBean | Local Enterprise Bean | DC1 |
AF_Modules/RequestResponseBean | Local Enterprise Bean | RRB |
sap.com/com.sap.aii.af.soapadapter/XISOAPAdapterBean | Local Enterprise Bean | SOAP |
AF_Modules/DynamicConfigurationBean | Local Enterprise Bean | DC2 |
AF_Modules/ResponseOnewayBean | Local Enterprise Bean | ROB |
I will not go into the configuration for RequestResponseBean and ResponseOnewayBean, as this is described in other blogs.
The module parameters for the DynamicConfigurationBean are following. In my scenario, I used the dynamic value "Value" with namespace "strDocNum".
Those values might not be the best choices, however it works anyway.
Module Key | Parameter Name | Parameter Value |
---|---|---|
DC1 | key.1 | write strDocNum Value |
DC1 | value.1 | module.strDocNum |
DC2 | key.2 | read strDocNum Value |
DC2 | value.2 | module.strDocNum |
For the graphical mapping tool, it is necessary to create user-defined functions to store the values in the dynamical header fields and read them from there. Here are the functions that are used in my scenario:
PutDocNum |
---|
public String PutDocNum(String docnum, String username, Container container) throws StreamTransformationException{ DynamicConfiguration conf = (DynamicConfiguration)container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION); DynamicConfigurationKey keySource1 = DynamicConfigurationKey.create("strDocNum","Value");
if (conf != null) { conf.put(keySource1, docnum); }
return username; |
Note: as the value DocNum was not part of the target message, the UDF was tied to another target field called username.
GetDocNum |
---|
public String GetDocNum(Container container) throws StreamTransformationException{ DynamicConfiguration conf = (DynamicConfiguration)container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION); if (conf != null) { DynamicConfigurationKey keySource1 = DynamicConfigurationKey.create("strDocNum","Value"); return conf.get(keySource1); } else return ""; |
Here is the link to the online help, the parameter value module.nn is still not mentioned: