on 07-04-2012 5:42 PM
hi
I am working on a SOAP to proxy sync scenario and want to remove the namespace prefix in the response mapping as the sender system cannot accept namespace prefixes...
XMLanonymizer bean does not work in the sender soap adapter
Can anyone help with the XSLT code for removing the namespace prefix
Requirement –
Remove all namespace prefixes in the input xml ( it can be ns0 / ns1 etc )
Sample input –
<?xml version="1.0" encoding="UTF-8" ?>
<ns0:ORDERRESPONSE xmlns:ns0="http://www.opentrans.org/XMLSchema/1.0" version="1.0">
<ns0:ORDERRESPONSE_HEADER>
<ns0:ORDERRESPONSE_INFO>
<ns0:ORDER_ID>xxxxx</ns0:ORDER_ID>
Sample output –
<?xml version="1.0" encoding="UTF-8" ?>
<ORDERRESPONSE xmlns ="http://www.opentrans.org/XMLSchema/1.0" >
<ORDERRESPONSE_HEADER>
<ORDERRESPONSE_INFO>
<ORDER_ID>xxxxx<ORDER_ID>
Hi Shash,
You must use XSLT because the SOAP SENDER Adapter it's not avaliable to use modules with transfer protocol http.
You can use modules and Sender Soap Adapter, but you must change the protocol to Axis etc..
Check ths link below buddy:
http://help.sap.com/saphelp_nw04/helpdata/en/fc/5ad93f130f9215e10000000a155106/content.htm
"You cannot enhance this adapter with your own modules on the Module tab page in the module processor. "
Check this link about xslt:
http://wiki.tei-c.org/index.php/Remove-Namespaces.xsl
Kind regards,
Viana.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shah,
Use the below xslt code and it will remove the namespace from the XML.
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="xml" version="1.0" encoding="UTF-8" />
<xsl:template match="*">
<xsl:element name="{local-name()}" >
<xsl:apply-templates select="@* | node()"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Thanks,
Asif
Hi Shah,
Use this XSL below:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="no" omit-xml-declaration="no" />
<xsl:template match="/ |comment() |processing-instruction()">
<xsl:copy>
<xsl:apply-templates select="/*" />
</xsl:copy>
</xsl:template>
<xsl:template match="*">
<xsl:element name="{local-name()}" namespace="{namespace-uri()}">
<xsl:apply-templates select="@*|node()" />
</xsl:element>
</xsl:template>
<xsl:template match="@*">
<xsl:attribute name="{local-name()}">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
Regards,
BR.
Viana.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Few cents...
This is synchronous interface. You are having issues during response sending to the sender system. Is that right? You can do this using XMLAnonymizerBean. Plus this namespace prefix you see in the test mapping tool. During run time I believe you do not see this problem. Have you tried running in the end to end scenario.
Please refer these sap links
http://help.sap.com/saphelp_nw04/helpdata/en/a4/f13341771b4c0de10000000a1550b0/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/45/d169186a29570ae10000000a114a6b/content.htm
Hope that helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi.
You have multiple options to remove namespace .By JavaMapping, XSLT Mapping as you mention.
You can try on AdapterModule you can use XMLanonymizerBean to remove namespace.
http://help.sap.com/saphelp_nw04/helpdata/en/2e/bf37423cf7ab04e10000000a1550b0/frameset.htm
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.