Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
I was working in a Synchronous scenario, where to push Invoice data on a server. To fulfill this requirement I faced two challenges.

1.) When I call the PushInvoice API it needs one AuthToken which I need to generate using 2nd  Token API.

2.) The response from PushInvoice API is encrypted, to decrypt the response I have one session key which I received during the Token API call.


To decrypt the response I need to pass this sessing key from RQ to RS and during the RQ mapping, I need to call 2nd Token API. Generally, dynamic configuration exists only till the message sent to the receiver and to call the 2nd API we can use JAVA URI classes.

To overcome this I have created one communication channel in ID for Token API and called this channel in message mapping using SystemAccessor and Lookup Services. Further, I have passed the token and session key using dynamic configuration and in response mapping, I have captured the session key by using Dynamic Configuration Bean.


NOTE: While using this you can only call the receiver channel which generates some response. we can not call the FTP channel which this class.


ESR Part:

Java UDF to call Communication Channel

You can write this UDF in the init method of Message mapping, as this function execute before the message mapping operation.
/* 	message: String which contains the request payload for Auth API
String lv_payloadContent = "";
Channel restChannel;
try {
restChannel = LookupService.getChannel("BC_Component", "CC_RestToken_rcv");
SystemAccessor restAccessor = LookupService.getSystemAccessor(restChannel);
InputStream inputStream = new ByteArrayInputStream(message.getBytes());
Payload payload = LookupService.getXmlPayload(inputStream);
Payload response =;

ByteArrayOutputStream resultbyte = new ByteArrayOutputStream();
Byte[] buffer = new byte[1024];
int length;
while ((length = response.getContent().read(buffer)) != -1) {
resultbyte.write(buffer, 0, length);
lv_payloadContent = resultbyte.toString("UTF-8");
} catch (LookupException e) {
// TODO Auto-generated catch block
} catch (IOException e) {
// TODO Auto-generated catch block


After parsing the response, I have captured the Token and decryption key in two variables and passed them dynamic configuration.

here I stored token and decryption key in two variables which I have passed in this UDF.


Java UDF to pass values in Dynamic Configuration
Map<String, Object> all = container.getInputHeader().getAll();
try {
DynamicConfiguration config = (DynamicConfiguration) all
DynamicConfigurationKey key1 = DynamicConfigurationKey.create("",
DynamicConfigurationKey Sek = DynamicConfigurationKey.create("", "SessionKey");
config.p ut(key1, lv_AuthToken);
config.put(Sek, lv_decSek);
} catch (Exception e) {
trace.addDebugMessage("[ERROR] Unable to set dynamic configuration "+e.getMessage());

DynamicConfigurationKey.create("", "SessionKey");

please note the namespace as and key name as this needs to be used in the module configuration in the REST receiver channel.


ID Part

In the receiver channel, we need to maintain certain DynamicConfigurationBean parameter which is used to pass the values between different messages.

I am using a REST receive channel which is used to generate Invoice. (in my scenario)


Processing sequence

number Module Name Type Module Key
1 AF_Modules/DynamicConfigurationBean Local Enterprise Bean Sender
2 Local Enterprise Bean rest
3 AF_Modules/DynamicConfigurationBean Local Enterprise Bean Receiver

Module Configuration

Module Key Parameter Name Parameter Value
Sender key.1 write SessionKey
Sender value.1 module.
Receiver key.1 read SessionKey
Receiver value.1 module.



Here I am getting only session key in RS mapping as I have passed only the session key in module configuration in the REST channel.

Labels in this area