cancel
Showing results for 
Search instead for 
Did you mean: 

payload with CDATA

Former Member
0 Kudos

My requirement is I need to put the whole payload string with in CDATA tag.

Iam getting payload as String from SAP R/3 into XI and to third party system. Tird party system needs whole payload string with in CDATA tag.

When I do that all angular brackets, quotations, ampersand <, >, ", & are turning to special characters &gt , &lt .

Please advise.

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

> Iam getting payload as String from SAP R/3 into XI and to third party system.

> When I do that all angular brackets, quotations, ampersand <, >, ", & are turning to special characters &gt , &lt .

When you receive the whole payload as string, then the sender escapes the <,>,&. not PI

So your task is to de-escape the incoming string and put CDATA around?

Answers (3)

Answers (3)

Former Member
0 Kudos

You can use an XSLT to perform this task

Former Member
0 Kudos

>Tird party system needs whole payload string with in CDATA tag.

What does means by this post? when you say whole payload..it means you are talking about complete xml..right?

Are you sure that what you posted is equal to what you implemented?

Edited by: Farooq Farooqui on Jun 23, 2010 12:09 AM

Former Member
0 Kudos

>

> >Tird party system needs whole payload string with in CDATA tag.

>

> What does means by this post? when you say whole payload..it means you are talking about complete xml..right?

>

> Are you sure that what you post is equal to what you implemented?

Yes I mean whole payload, remember Isaid whole payload is coming as string.

As I said it may not the good way to wrap the whole payload in CDATA, but it is working.

I tried Java map using DOM Parser, but I was stuck while the passing the input I received in output.

DocumentBuilder builderel = factory.newDocumentBuilder();

//Document docIn = builderel.parse(in);

//Create the output DOM

Document docOut = builderel.newDocument();

String msgName = "ns1:abcXMLRequest";

String nameSpace="urn:com.abcdef.schemas:enttechservice:abc";

root = docOut.createElement(msgName);

root.setAttribute("xmlns:ns1", nameSpace);

docOut.appendChild(root);

Element idEl = docOut.createElement("applicationXMLString");

root.appendChild(idEl);

CDATASection cd = docOut.createCDATASection( got stuck here it expects a string argument here); // I need to pass the input I recived in to XI as it is.

root.appendChild(cd);

domS = new DOMSource(docOut);

stefan_grube
Active Contributor
0 Kudos

When you use Java mapping, just treat the whole InputStream as String and add before and after that string the CDATA wrapper.

Former Member
0 Kudos

Hi Vamsi,

If you are on PI 7.1 then you can see this blog:

/people/jyothi.anagani/blog/2010/06/17/convert-the-input-xml-to-string-in-pi-71-using-standard-graphical-mappingSDNWeblogs_SapExchangeInfrastructurexi%2528SAPNetworkWeblogs%253ASAPExchangeInfrastructure%2528XI%2529%2529

If other versions simple xsl mapping should do. See the code here:

Regards,

---Satish

Former Member
0 Kudos

Hi Vamsi,

have a look at this blog /people/danny.deroovere/blog/2008/11/30/how-to-map-cdata-to-a-structured-message-in-xi

Regards,

Srinivas

Former Member
0 Kudos

Srinivas,

This blog tell to strip the CDATA tag and extract the XML out of it.

I want wrap the whole payload into a CDATA tag.

Stefan,

The reason why Iam doing this, after XI, it is passing through another infrastrcutre (non SAP) and it does a schema validation,before the message goes to third party system

To make sure the infrastrcture does not fail, we need to wrap the whole payload string in to a CDATA tag.

Former Member
0 Kudos

Map this.

source root node---->CDATA filed.

Now right click on sourcerootnode (in mapping editor screen) and select "return xml".

I hope it may solve your problem.

-Farooq

Edited by: Farooq Farooqui on Jun 22, 2010 9:21 PM

Former Member
0 Kudos

I have implemented a solution here, not sure if it is a good way.

I have created three varibales at my target data structure and assigned constants like below

var1 = <![CDATA[

var2 = normal mapping from source element (I mentioned I have only one element in my source)

var3 = ]]

target_element1

I have concateneted var1 + Var2 + var3 and mapped to target_element1.

Surprisingly it worked for me, not sure if it is a good way.

stefan_grube
Active Contributor
0 Kudos

> My requirement is I need to put the whole payload string with in CDATA tag.

There have been a lot of same questions recently. I wonder why an application requests an XML, where another XML is hidden in a CDATA section? Can somebody explain it to me?