cancel
Showing results for 
Search instead for 
Did you mean: 

accessing dynamically configured filename inside adapter module code.

Former Member
0 Kudos

Hi,

I am having a requirement where i have to access the filename configured using Dynamic configuration inside my receiver file adapter MODULE code. I am having PI7.1.

For accessing the DC filename i have inserted this piece of code inside my adapter module code:

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

String filename = msg.getMessageProperty(MPK);

But when i am tesing this module i am getting: "Message processing failed. exception encrypting session key".

This module is basically written for encryption.I am referring this blog:

/people/daniel.graversen/blog/2006/10/05/dynamic-configuration-in-adapter-modules

Do i need to do something else for accessing DC filename inside my module??Please help??

Thanks

Amit

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

My code is something like this:

public ModuleData process(ModuleContext mc,

ModuleData inputModuleData)

throws ModuleException {

Object obj = null;

Message msg = null;

MessageKey amk = null;

String inpKeyLocation = (String) mc.getContextData("inpKeyLocation");

try {

obj = inputModuleData.getPrincipalData();

msg = (Message) obj;

amk = new MessageKey(msg.getMessageId(),msg.getMessageDirection());

XMLPayload xpld = msg.getDocument();

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

String filename = msg.getMessageProperty(mpk);

InputStream inps = (InputStream) xpld.getInputStream();

and so on ......

My encryption method somewhere down the line will use "filename" as one of its input.

Please help??

Thanks

Amit

Edited by: AmitSri on May 25, 2010 1:43 PM

former_member192892
Active Contributor
0 Kudos

Plz try this and let us know if this works.

String fileName = msg.getMessageProperty("http://sap.com/xi/XI/System/File", "FileName");

Former Member
0 Kudos

Hi Varun,

I am using PI 7.1and referring this java doc:

http://help.sap.com/javadocs/pi/SP3/xpi/com/sap/engine/interfaces/messaging/api/Message.html#getMess...

where it has been mentioned :

String getMessageProperty(String namespace, String name)

Deprecated. Use getMessageProperty(MessagePropertyKey), instead.

But stil i have used this and getting the same session key encryption exception.

Thanks

Amit

Former Member
0 Kudos

Amit,

Are you sure, that retrieving the file name is causing the issue?

The coding looks good to me. Is it possible the issue pops up with your logic for encryption?

Just try printing the file name retrieved to the audit log and check.