cancel
Showing results for 
Search instead for 
Did you mean: 

DynamicConfigurationException:Unable to set ASMA in Module

Former Member
0 Kudos

Hi,

I have written customized adaptor module and trying to set the FileName to Dynamic Configuration object. But it is throwing error.

I used the below code:

{

Message msg = null;

MessagePropertyKey key= new MessagePropertyKey("http://sap.com/xi/XI/System/File","FileName");

msg.setMessageProperty(key,"Testing");

moduledata.setPrincipleParameter(msg);

}

I have enabled "FileName" the ASMA(adapter specific message attribute) in receiver communication channel. But it is throwing the below exception.

"DynamicConfigurationException:: The adapter message property "FileName" was specified as mandatory element, but was not supplied in XIMessageHeader".

Working on PI7.1.

Please let me know, if i need to do any changes.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Check your XI headers whether the ASMA for Filename is properly set.

Also when calling MessagePropertyKey it should be MessagePropertyKey("FileName","http://sap.com/xi/XI/System/File")

Hope that helps.

Former Member
0 Kudos

Hi Erwin,

I have already tryed MessagePropertyKey it should be MessagePropertyKey("FileName","http://sap.com/xi/XI/System/File"); But it was not helped to my problem.

Former Member
0 Kudos

Thank Erwin!!

This is has solved my problem. I used the below code.

MessagePropertyKey key1 = new MessagePropertyKey("FileName","http://sap.com/xi/XI/System/File");

msg.setMessageProperty(key1,filename);

inputModuleData.setPrincipalData(msg);

Answers (4)

Answers (4)

Former Member
0 Kudos

"DynamicConfigurationException:: The adapter message property "FileName" was specified as mandatory element, but was not supplied in XIMessageHeader".

I used the below code:

{

Message msg = null;

MessagePropertyKey key= new MessagePropertyKey("http://sap.com/xi/XI/System/File","FileName");

msg.setMessageProperty(key,"Testing");

moduledata.setPrincipleParameter(msg);

}]\

just you have to use below code insted of what ever u wrote the code.

String DynamicConfig(String a, Container container) throws StreamTransformationException{

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");

conf.put(key,a);

return "";

}

and in Receiver file communication channel , just you have to enable ASMA and file name.

Note:

if Ur scenario is File To File then just enable Asma and file name in both sender and receiver adapters.

Former Member
0 Kudos

try this:


MessagePropertyKey mpk = new MessagePropertyKey("FileName","http://sap.com/xi/XI/System/File");
msg.setMessageProperty("http://sap.com/xi/XI/System/File","FileName","Testing");

chk my wiki this may be helpful for setting dynamic file name using adapter module:

http://wiki.sdn.sap.com/wiki/display/Snippets/DynamicfilenameinaFiletoFilepassthroughscenario

Former Member
0 Kudos

Hi Amit,

I have already tested with below code.

This works for PI7.0.

MessagePropertyKey mpk = new MessagePropertyKey("FileName","http://sap.com/xi/XI/System/File");

msg.setMessageProperty("http://sap.com/xi/XI/System/File","FileName","Testing");

But in PI 7.1 msg.setMessageProperty("http://sap.com/xi/XI/System/File","FileName","Testing"); is deprecated.

we have msg.setMessageProperty(key,value); where is key= MessagePropertyKey and value=filename...

former_member184681
Active Contributor
0 Kudos

Hi,

Try my code above with DynamicConfiguration & DynamicConfigurationKey objects. I used them successfully with PI 7.1.

Greg

former_member184681
Active Contributor
0 Kudos

Hi,

It looks like the file name you are trying to set is not captured by the receiver adapter. Try changing the code to the following:

String filename = new String("");
DynamicConfiguration conf1 = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http:/"+"/sap.com/xi/XI/System/File","FileName");
filename = "somefilename.xml"; //put your own name here
conf1.put(key1,filename);

Hope this helps,

Greg

Former Member
0 Kudos

Hi,

Container object will not be available at module level. we can use this at java mapping level or udf.

Former Member
0 Kudos

you can use udf level only.....

String DynamicConfig(String a, Container container) throws StreamTransformationException{

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");

conf.put(key,a);

return "";

}

and in Receiver file communication channel , just you have to enable ASMA and file name.

Former Member
0 Kudos

Hii Madhu,

Basically you are trying to set FileName to Dynamic Config Object. You've mentioned that in Reciever Comm Channel >ASMA (Adapter Specific Message Attributes)> FileName is enabled. Is the same enabled in Sender Comm Channel too ? For ASMA, the same set of parameters are needed to be checked in both the comm channels. I think this should resolve ur issue.

Thanks