on 11-25-2014 5:02 AM
Hi All,
I want to change only namespace(Replace namespace) from outgoing message to receiver. Is it possible...
I checked Module: XMLAnonymizerBean, however it seems it can not replace namespace. It is only changing namespace prefix.. If any body have idea, please share..
XML generated in mapping:
<?xml version="1.0" encoding="UTF-8"?>
<ns1:Structure xmlns:ns1=http://abcxyz.com>
<Element1> content </Element1>
<Structure>
Receiver expecting like:::::::
<?xml version="1.0" encoding="UTF-8"?>
<ns1:Structure xmlns:ns1=http://pqrxyz>
<Element1> content </Element1>
<Structure>
Regards, Uma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vila,
Result of my Mapping output xml is below
<?xml version="1.0" encoding="UTF-8"?>
<ns1:Structure xmlns:ns1="http://ABCXYZ.com">
<val1>value1</val1>
<val2>value1</val2>
<val3>value1</val3>
<val4>value1</val4>
</ns1:Structure>
But I am expecting like below
<?xml version="1.0" encoding="UTF-8"?>
<ns1:Structure xmlns:ns1="http://PQRABC.com">
<val1>value1</val1>
<val2>value1</val2>
<val3>value1</val3>
<val4>value1</val4>
</ns1:Structure>
So all my field names and values under root node remains same, but only namespace should get change.
What logic I can implement in xslt mapping...
Regards,
Hi Uma,
If you have this XML:
<?xml version="1.0" encoding="UTF-8"?>
<ns1:Structure xmlns:ns1="http://ABCXYZ.com">
<val1>value1</val1>
<val2>value1</val2>
<val3>value1</val3>
<val4>value1</val4>
</ns1:Structure>
If you apply the next XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns2="http://ABCXYZ.com" xmlns:ns1="http://PQRABC.com" exclude-result-prefixes="ns2">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xsl:copy>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="ns2:Structure">
<xsl:element name="ns1:{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>
You will get this output:
<?xml version="1.0" encoding="UTF-8"?>
<ns1:Structure xmlns:ns1="http://PQRABC.com">
<val1>value1</val1>
<val2>value1</val2>
<val3>value1</val3>
<val4>value1</val4>
</ns1:Structure>
Hope this helps.
Regards.
Hi,
You can have some idea from replace namespace uri using XSLT in SOAP message - Stack Overflow
Suman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The best way is to use XSLT mapping for this and change the namespace in mapping.
Suman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
96 | |
11 | |
11 | |
10 | |
9 | |
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.