cancel
Showing results for 
Search instead for 
Did you mean: 

Convert xml payload to a string in CPI

vks_vks1
Explorer
0 Kudos

Hi,

I want to store entire payload (request or response) to a string. Is there a way to ache ice the same in CPI using message mapping or XSLT?

MortenWittrock
Active Contributor

Hi Vikas

How do you need to use this string? It's straightforward to store the payload in a property, for instance, which you can then access later.

Regards,

Morten

vks_vks1
Explorer
0 Kudos

Hi 7a519509aed84a2c9e6f627841825b5a,

I want to map request or response payload (xml/json) to a string variable and insert into database table.

Regards,

Vikas

Accepted Solutions (1)

Accepted Solutions (1)

Sriprasadsbhat
Active Contributor
0 Kudos

Hello Vikas,

Follow below screenshot

1) Set right context ( if you are not aware of what context is please read some blogs on the same concept remains same for SAP CPI and SAP PO )

2) Select Return as XML;

Regards,

Sriprasad Shivaram Bhat

vks_vks1
Explorer
0 Kudos

Thanks sriprasadshivaramabhat. It worked and I was able to map xml payload to a string variable using message mapping.

Answers (1)

Answers (1)

Sriprasadsbhat
Active Contributor

Hello Vikas,

You can use 2 options.

1) Return as XML inside mesage mapping ( Same as SAP PO)

2) Set the input body into Property ( request ) and same for response body to then use custom functions to retrive the same . Refer below.

https://blogs.sap.com/2018/03/27/sap-cpi-accessing-header-and-property/

Regards,

Sriprasad Shivaram Bhat

vks_vks1
Explorer
0 Kudos

Hi sriprasadshivaramabhat,

Thanks for your response. Could you please elaborate option 1 in details as I am not familiar with SAP PO? Basically I want to map xml payload (request or response) to a string variable using message mapping.