cancel
Showing results for 
Search instead for 
Did you mean: 

How to extract XI-header fields from XI-message in JAVA?

Former Member
0 Kudos

Hi all,

We are trying to build a custom adapter module, in order to create an additional attachment for our XI message. In this attachment we want to put the ID of the XI-payload (see below). Our first statement aims to get access to the XI-message:

Message msg = (message) inputModuleData.getPrincipalData();

Now we want to get the ID of the XI-payload, which is held in the XI-header fields as <i>blablabla</i> in <b><SAP:Payload xlink:href="blablabla"> etcetera</b>.

Does anyone know how to extract this information from the JAVA Message object msg within JAVA?

Thanks!!

Best regards, Maarten

Accepted Solutions (0)

Answers (3)

Answers (3)

fred_verheul
Active Contributor
0 Kudos

Hi all,

I'm a colleague of Maarten, and I think maybe we didn't explain well enough what we want. So let me try to elaborate:

We want to obtain the reference (within the SOAP-Body of the XI-message) to the attachment which contains the main payload (at least, in XI itself). This reference seems to have gone missing, once our adapter module (after having gone through XI) is entered (and, by the way, before we enter the SOAP-receiver-adapter).

The JAVA-representation of the XI-message seems to hide the fact that in XI itself, the main payload is an attachment, referenced from within the SOAP-Body.

Nevertheless, we would like to obtain/retain(?) that reference, in order to put it in our own to-be-created-additional-attachment, which would go (via the PayloadSwapBean-module of SAP) into the SOAP-body of the final SOAP-call, and should then reference the 'new attachment' (which was (in XI itself) the main payload).

So, I think both answers (up to now) don't help us much (however: thanks for your reaction anyway of course).

So, maybe someone has another idea?

Regards, Fred

Former Member
0 Kudos

I have moved my question to an own thread: [|]

Former Member
0 Kudos

Hi Maarten,

You can access the XI Message Id in Adapter module by calling

MessageObj.getMessageId()

try the following code..

 
 Object dataObject = null;
 Message xiMessage = null;
			
 dataObject = modData.getPrincipalData();
 xiMessage = (Message) dataObject;

 String msgID = xiMessage.getMessageId();

Regards,

Ananth

udo_martens
Active Contributor
0 Kudos

Hi Maarten,

  
String headerField;
java.util.Map map;

// get runtime constant map

map = container.getTransformationParameters();

// get value of header field by using variable key

headerField = (String) map.get("MessageId");

have a look to http://help.sap.com/saphelp_nw04/helpdata/en/b3/9a2aeb24dc4ab6b1855c99157529e4/content.htm

Regards,

Udo