cancel
Showing results for 
Search instead for 
Did you mean: 

How to change the namespace

Former Member
0 Kudos

Hi Experts,

i have sent the PO’s. The
files look good, except for the name space, ‘nm’ instead of ‘n0’.

What they received:

<nm:PurchaseOrderERPRequest_V1 xmlns:nm="http://sap.com/xi/"

What they expect:

<n0:PurchaseOrderERPRequest_V1 xmlns:n0="http://sap.com/xi"

can you please give me the better solution on this.

Thanks ,

Abhilash.

Accepted Solutions (1)

Accepted Solutions (1)

iaki_vila
Active Contributor
0 Kudos

Hi Abhilash,

First of all Eng is right and the name of the namespace shouldn't be important, the important is its value.

However you can do it using the XMLAnonymizerBean http://scn.sap.com/community/pi-and-soa-middleware/blog/2012/07/10/handling-namespaces-in-pi-using-x...

Also you can do it with an XSLT mapping easily.

Regards.

Former Member
0 Kudos

hi inaki,

iam using HTTP channel receiver side , module tab is not enabled.

Answers (1)

Answers (1)

engswee
Active Contributor
0 Kudos

Hi Abhilash

The actual value of the prefix nm/n0 does not really matter as long as it matches the declaration part xmlns:<prefix>.

What type of application is the receiver system?

Rgds

Eng Swee

Former Member
0 Kudos

Hi

Thanks for quick reply.

Process flow is proxy to http.

engswee
Active Contributor
0 Kudos

Anyway, if you really need to, you can try adding the following XSLT


<xsl:stylesheet xmlns:n0="http://sap.com/xi/"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

  <xsl:output method="xml" encoding="UTF-8" indent="yes"/>

  <xsl:template match="*[local-name()='PurchaseOrderERPRequest_V1']">

  <n0:PurchaseOrderERPRequest_V1 xmlns:n0="http://sap.com/xi/">

  <xsl:apply-templates select="@* | node()"/>

  </n0:PurchaseOrderERPRequest_V1>

  </xsl:template>

  <xsl:template match="/ | @* | node()">

  <xsl:copy>

  <xsl:apply-templates select="@* | node()"/>

  </xsl:copy>

  </xsl:template>

</xsl:stylesheet>

engswee
Active Contributor
0 Kudos

Inaki's advise on using the AnonymizerBean is better. I only know it was possible to remove namespaces with that module, but did not know until now it was possible to change the prefix with it too. Check out the Wiki in the Reference section of the blog Inaki provided.

iaki_vila
Active Contributor
0 Kudos

Another XSLT example:


<?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" encoding="UTF-8"/>

        <xsl:template match="*">

                  <n0:PurchaseOrderERPRequest_V1 xmlns:n0="http://sap.com/xi">

                    <xsl:copy-of select="/child::*/child::*"/>

                    </n0:PurchaseOrderERPRequest_V1>

     </xsl:template>

</xsl:stylesheet>

Regads.

engswee
Active Contributor
0 Kudos

Nice. Definitely more compact than my amateur attempt at it

iaki_vila
Active Contributor
0 Kudos

Hi Eng,

Check the example 3 in the note 880173 - XI 3.0 Adapter Framework XML Anonymizer Module , it is possible to change namespaces.

Regards.

engswee
Active Contributor
0 Kudos

Yes, I think I came across that before but probably forgotten about it as did not actually use it in my work. Maybe getting old too