cancel
Showing results for 
Search instead for 
Did you mean: 

xsd to string conversion

venkatasap
Participant
0 Kudos

Hi Sapall.

i have got a tricky situation on an IDOC to webservice Interface where the requirement is after getting the data from IDOC to Webservice xsd structure ,PI need to convert the same xsd into a single element containing a XML string .so that the single element will be sent to reciever webservice.

so can any one help me in getting this solution in providing either java mapping code or UDF and how to do to achieve this.

your answer would be appreciated.

regards.

Varma .

Accepted Solutions (1)

Accepted Solutions (1)

former_member190389
Active Contributor
0 Kudos

For the following source

<AdXML>

<Name>abc</Name>

</AdXML>

The below code will

convert to

<?xml version="1.0" encoding="utf-8"?>

<p2:Request xmlns:p2="http://api.oas.tfsm.com/"><String_1/><String_2>

<![CDATA[<AdXML>

<Name>abc</Name>

</AdXML>]]></String_2></p2:Request>

This is an XSL mapping modify the source and target according to your structure .

save the code in .xsl file from notepad.

Zip it and import in Imported Archive and use in interface mapping.


<?xml version='1.0' ?>
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl">
<xsl:strip-space elements="*"/>
<xsl:output method="xml" version="1.1" encoding="utf-8"/>
<xsl:template match="/">

<p2:Request xmlns:p2="http://api.oas.tfsm.com/">

<String_1><xsl:copy-of select="Name"/></String_1>

<String_2>
<xsl:text disable-output-escaping="yes">
<![CDATA[<![CDATA[

]]
>

  
 



]]>

Answers (1)

Answers (1)

jyothi_anagani
Active Contributor
0 Kudos

Hi Varma ,

On which Version of PI you are working ?

If it is PI 7.1, please refer the below link.

/people/jyothi.anagani/blog/2010/06/17/convert-the-input-xml-to-string-in-pi-71-using-standard-graphical-mapping

Else..

Refer This.. http://wiki.sdn.sap.com/wiki/display/XI/JavaMapping-ConverttheInputxmlto+String

OR

/people/michal.krawczyk2/blog/2005/11/01/xi-xml-node-into-a-string-with-graphical-mapping

Thanks.