cancel
Showing results for 
Search instead for 
Did you mean: 

Pass variables between message mappings

Former Member
0 Kudos

Hi all,

I have a synchronous scenario as below:

System A --> SOAP Request --> XI --> RFC --> XI --> SOAP Response --> System A

I'm doing this without using ccBPM, so there are 2 message mappings to map the request message and the response message respectively.

My question is, when I have 2 seperate mappings, how do I pass a variable from the request message back into the response message?

I've indicated an example below. The value to be passed back in the response is messageId.

<b><u>Message Mapping for Request:</u></b>

Request Message from System A:

<Header>

<b><messageId>1234</messageId></b>

</Header>

<Body>

<name>a</name>

</Body>

Input Message to RFC

<Body>

<name>a</name>

</Body>

<b><u>Message Mapping for Response:</u></b>

Output message from RFC

<Body>

<name-transformed>b<name-transformed>

<Body>

Response message back to System A

<Header>

<b><messageId>1234</messageId></b>

</Header>

<Body>

<name-transformed>a</name-transformed>

</Body>

Please help.

Thanks.

Ron

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

HI,

RFC to SOAP

/people/shabarish.vijayakumar/blog/2008/01/08/troubleshooting--rfc-and-soap-scenarios-updated-on-20042009

/people/shabarish.vijayakumar/blog/2006/03/23/rfc--xi--webservice--a-complete-walkthrough-part-1

/people/piers.harding/blog/2004/07/18/you-dont-need-to-use-soap-to-keep-your-rpc-clean

/people/shabarish.vijayakumar/blog/2006/03/28/rfc--xi--webservice--a-complete-walkthrough-part-2

/people/david.halitsky/blog/2006/08/25/soa-vs-rfc-it-doesnt-have-to-be-charles-bronson-vs-henry-fonda

/people/michal.krawczyk2/blog/2005/03/29/configuring-the-sender-rfc-adapter--step-by-step

Regards

Chilla..

Former Member
0 Kudos

HI,

if you use BPM

It is possible to correlation two msgs..and response also..

see below links

/people/sravya.talanki2/blog/2005/08/24/do-you-like-to-understand-147correlation148-in-xi

Regards

Chilla..

Former Member
0 Kudos

HI,

For lookups use can see the below links

SOAP Lookup - /people/bhavesh.kantilal/blog/2006/11/20/webservice-calls-from-a-user-defined-function

Lookup - /people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer

Also read thru this to get more idea on lookups -

http://help.sap.com/saphelp_nw04/helpdata/en/cf/406642ea59c753e10000000a1550b0

Lookup’s in XI made simpler - /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler

How to check JDBC SQL Query Syntax and verify the query results inside a User Defined Function of the Lookup API -

http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm

/people/prasad.illapani/blog/2006/10/25/how-to-check-jdbc-sql-query-syntax-and-verify-the-query-results-inside-a-user-defined-function-of-the-lookup-api

Lookups - /people/morten.wittrock/blog/2006/03/30/wrapping-your-mapping-lookup-api-code-in-easy-to-use-java-classes

Regards

Chilla..

prabhu_s2
Active Contributor
0 Kudos

can u try to use a lookup functionality in mapping....use a udf.

when Message Mapping for Request have the value stored <b>1234</b> i.e. messageId, in a file or db using a lukup f/n and during the response mapping retrieve this value and pass it to the target field.

for db/rfc lukup refer to:

/people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler>Lookup’ [original link is broken] [original link is broken]

Message was edited by:

Prabhu S

Former Member
0 Kudos

Hi Prabhu,

I've thought about this solution.

But the problem is I need a key to retrieve this value, and again, the question is how do I pass the key to the response mapping?

Can global variables be used in this case?

Ron

prabhu_s2
Active Contributor
0 Kudos

dont have any keys to it...the messageid will be the key , when u retrive the data from either DB/File delete it or have a flag set so that in the next instance it wont read....

Former Member
0 Kudos

> dont have any keys to it...the messageid will be the

> key , when u retrive the data from either DB/File

> delete it or have a flag set so that in the next

> instance it wont read....

Hi Prabhu,

I'm not sure if this approach will behave in a multi-threaded environment.

Can you please explain in detail please?

Thanks.

Ron

prabhu_s2
Active Contributor
0 Kudos

until the messageid is unique there will be no issues but yes when it is not...might be u can concatenate some qualifiers like timedate stamp to it and then follow the process.

bhavesh_kantilal
Active Contributor
0 Kudos

Prabhu,

Message ID is always unique for every message in XI.

So the RFC lookup Approach is good except for the fact that we will need to perfrom Insert operation on the database which is not recommended.

Regards

Bhavesh

Former Member
0 Kudos

Hi all,

When you say

prabhu_s2
Active Contributor
0 Kudos

yeah...message id is unique...but for him it is his source input (thats what i understood)

Former Member
0 Kudos

> Prabhu,

>

> Message ID is always unique for every message in XI.

>

> So the RFC lookup Approach is good except for the

> fact that we will need to perfrom Insert operation on

> the database which is not recommended.

>

> Regards

> Bhavesh

Hi Prabhu,

Am I right by saying you are assuming the RFC lookup returns you a messageId as one of its fields?

For my case, the RFC does not contain this field, so I do not have any messageId to perform any lookup (DB/File/Static HashMap/etc).

Regards,

Ron

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

The Message ID I am referrring to Is the Messge ID of your message in XI.

You can access this Mesasage Id and then use this Message Id as the Key.

When insereting the data into the Database, you will need to insert XI's Mesaage Id as well as the Payload you receive in XI.

In the response mapping, you can again access the same Message Id and you can usr this to retreive the value in from the R3 Table.

Regards

Bhavesh

Former Member
0 Kudos

> Hi,

> The Message ID I am referrring to Is the Messge ID of

> your message in XI.

> You can access this Mesasage Id and then use this

> Message Id as the Key.

>

> When insereting the data into the Database, you will

> need to insert XI's Mesaage Id as well as the Payload

> you receive in XI.

>

> In the response mapping, you can again access the

> same Message Id and you can usr this to retreive the

> value in from the R3 Table.

>

> Regards

> Bhavesh

Thanks Bhavesh.

So how can I get the messageId of the XI message and use it in message mapping?

Thanks.

Ron

prabhu_s2
Active Contributor
0 Kudos
java.util.Map map = container.getTransformationParameters();
String msgid = (String) map.get ( StreamTransformationConstants.MESSAGE_ID);
return msgid;

MAYBE THIS HELPS

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

Refer into this link,

http://help.sap.com/saphelp_nw04/helpdata/en/b3/9a2aeb24dc4ab6b1855c99157529e4/content.htm

java.util.Map map;
String MessageID;
map = container.getTransformationParameters();
// get value of header field by using variable key
MessageID = (String) map.get("MessageId");

Regards

Bhavesh

Former Member
0 Kudos

> Hi,

>

> Refer into this link,

>

> http://help.sap.com/saphelp_nw04/helpdata/en/b3/9a2aeb

> 24dc4ab6b1855c99157529e4/content.htm

>

>

java.util.Map map;
> String MessageID;
> map = container.getTransformationParameters();
> // get value of header field by using variable key
> MessageID = (String) map.get("MessageId");

>

> Regards

> Bhavesh

Thanks.

Let me try this out.

I'll let you know the status soon.

Ron

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

Not possible without a BPM.

You will need a BPM to handle this.

Regards

Bhavesh

Former Member
0 Kudos

Bhavesh, How can a BPM handle this? Can you please explain?

Thanks.

prabhu_s2
Active Contributor
0 Kudos

if i'm right, u mayneed to store the data in a container element when u want to use it in a bpm

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

<b>Without BPM and Using RFC Lookup</b>

1. In your Request Mapping Retireve Message ID and use this as a Key and stored it in a ZTABLE using a RFC call using the LookUp API.

2. In the Response mapping use the Message Id as the key to retrieve the value.

Issues with this approach

1. RFC Lookup as the name implies should be used for Lookup and not for insertion of data into the database as this involves Transaction handling. Issue that can come , what happens if the RFC adapter is down and so on and so forth.

<b>With BPM</b>

1. Receive Request in BPM . Turn on Synch Asynch Bridge here

2. Send Synch to call the Webservice

3. Have a N:1 Mapping next. The source to this will be the Request Message Received in Step 1 and the Resoponse Receievd in Step 2.

4. Send Step to send final response back. Closes Synch Asynch Bridge.

Regards

Bhavesh

Former Member
0 Kudos

Hi,

<i>My question is, when I have 2 seperate mappings, how do I pass a variable from the request message back into the response message?</i>

I hope...

Prepare two Msg mappings and in Interface mapping use just add two msg mappings i mean two mappings

source to target 1

target 1 to final target

i hope yuo got it clearly..

Regards

Chilla..

Former Member
0 Kudos

Hi Chandar,

Yes both of them are in the same Interface Mapping - Request/Response.