cancel
Showing results for 
Search instead for 
Did you mean: 

Change namespace and prefix in SOAP synchronous scenario

0 Kudos

Hi,

I know that it is possible to modify XML namespace and prefix in a SOAP receiver channel using XMLAnonymizerBean module.

But how can I handle this in a synchronous scenario, having a SOAP sender channel with QoS "BE"?

I already tried this two solutions:

- using XMLAnonymizerBean in SOAP sender channel doesn't affect the response payload;

- using an XSLT mapping on the response section of my operation mapping leads to an error

Thanks, regards.

Accepted Solutions (1)

Accepted Solutions (1)

former_member186851
Active Contributor
0 Kudos

Hello Matteo,

XSLT mapping should be good.

what is the error being thrown?.

0 Kudos

Hello, with my XSLT I modify both namespace and prefix.

Let's say I want to replace the standard "ns1" with the value "xyz". When the OM is executed, it throws an error like "ns1 namespace not found".

The XSLT is something like this:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

                xmlns:xyz="http://www.xxxxxxxxx.com/xxx">

  <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>

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

    <xsl:copy>

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

    </xsl:copy>

  </xsl:template>

  <xsl:template match="/*">

    <xsl:element name="xyz:{local-name()}">

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

    </xsl:element>

  </xsl:template>

  <xsl:template match="*/*">

    <xsl:element name="{local-name()}">

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

    </xsl:element>

  </xsl:template>

</xsl:stylesheet>

(I also tried with "ns1" instead of "xyz")

Thanks.

former_member186851
Active Contributor
0 Kudos

Hello,

Try refering the below discussion and try the code in those links.

http://stackoverflow.com/questions/13974473/changing-the-namespace-with-xslt-1

former_member182412
Active Contributor
0 Kudos

Hi Matteo,

Use below XSLT:


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

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns1="http://www.myCompany.com/xxx" xmlns:xyz="http://www.myCompany.com/yyy">

   <xsl:output encoding="utf-8"/>

   <xsl:template match="ns1:*">

      <xsl:element name="xyz:{local-name()}" namespace="http://www.myCompany.com/yyy">

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

      </xsl:element>

   </xsl:template>

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

      <xsl:copy>

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

      </xsl:copy>

   </xsl:template>

</xsl:stylesheet>

Regards,

Praveen.

former_member182412
Active Contributor
0 Kudos

Hi Matteo,

You can do with message mapping also as per this blog

UDF:

Regards,

Praveen.

0 Kudos

Dear Praveen,

  thank you very much for the hint! This solution works like a charm and is very clean. With XSLT, even with the one suggested by you, still was getting error.

Thank you, regards.

former_member186851
Active Contributor
0 Kudos

Hello Matteo,

In the Operation mapping try enabling/Disabling the SAP XML kit option.

Might be it will work for XSLT mapping.

Answers (0)