cancel
Showing results for 
Search instead for 
Did you mean: 

Need to add xml tag in the request message

Former Member
0 Kudos

Hello Experts,

Need ur help.

Right now i am working on the scenario Http -> to -> Proxy.

Whatever request i am getting is not having XML tag in it, and because of that my mapping is failing.

Can you tell me that how can i add XML tag in my request so it will not fail in Mapping?

Need to add : <?xml version="1.0" encoding="UTF-8"?> in request.

Thanks,

Hetal

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Added the module in Receiver adapter

nisarkhan_n
Active Contributor
0 Kudos

just wondering how did you add an module in case of HTTP to proxy?

Former Member
0 Kudos

HI Hetal

Instead of adding this to the source message. Remove this tag from mapping.

Use a XSLT mapping without this initial tag. it will work.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:m="http://namespace">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
<xsl:template match="/">
<xsl:for-each select="//tag">
<xsl:value-of select="." disable-output-escaping="yes"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

Use this mapping without

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

If you still see XML tag then use

<xsl:output method="html"

instead of

<xsl:output method="xml"

Thanks

Gaurav

nisarkhan_n
Active Contributor
0 Kudos

Write an java map, put this map at the top of the in Interface Mapping.

use the code below.

public void execute(InputStream in, OutputStream out) throws com.sap.aii.mapping.api.StreamTransformationException

{

String inString = null;

String xmlRoot = "<?xml version="1.0" encoding="UTF-8"?>";

StringBuffer outString = new StringBuffer();

inString = (convert the InputStream in to String and assign to inString)

outString.append(xmlRoot);

outString.append(inString );

//Convert the StringBuffer to String.

out.write(outString.toString().getBytes("UTF8")); //Convert this String to OutputStream and send it out)

}