on 01-22-2009 8:23 PM
Hi,
I had an requirement to get the the Filename and map to the target payload.
I had configured the File Sender Adapter settings in the ID
This is the following UDF i got from SDN.
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String ourSourceFileName = conf.get(key);
return ourSourceFileName;
But when iam using this UDF iam getting an error
RuntimeException in Message-Mapping transformation: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._MM_ORDER_CRS_OB_SAP_PROXY_IB_ method Filename$[com.sap.aii.mappingtool.tf3.rt.Context@54e154e1]
Please help me in correcting the error.
Thanks
Srinivas
did the error come from testing the real scenario or from the test using the Test tab in MM editor? The code only works in real scenario.
Jayson
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jayson,
actually, in the interface mapping, it doesn't give exception.
The DynamicConfiguration is a constant retrieved from the container object, so it will never be returned as null (given that the container object was instantiated).
Just the retrieved value will be null (since it was not previously set), but no exception occurs.
In the message mapping, the container object is never instantiated, and that's the reason for the NullPointerException.
Regards,
Henrique.
Thanks for all the Answers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The code is fine. It would only work in the end to end scenario, bcos then only you will get the filename.
For this code to work you have to set Adapter Specific Identifier in the Adapter Channel.
So in the Communication Channel->Adapter-Specific Message Attributes-> File Name(Tick it).
Then only you will be able to access filename.
Regards
Arpil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.