on 04-22-2014 7:04 PM
Hi All
I have a source structure below
<ns1:Product_MT xmlns:ns1="urn:alpha:websub" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Header>
----
---
</Header>
<Item>
--
---
</Item>
</ns1:Product_MT>
I am using a soap sender getting called from SOAP UI to consume a PI web service and send the output message to receiver HTTP channel
the receiver needs the namespace of the XML structure as below (ns1 changed to ns)
<ns:Product_MT xmlns:ns="urn:alpha:websub" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Header>
----
---
</Header>
<Item>
--
---
</Item>
</ns:Product_MT>
I tried to put the xmlanonymizer bean in receiver HTTP but its not doing anything. I am stil getting the output with ns1 namespace
Attached screenshot of receiver http adapter configuration in module
also, I tried to use XSLT mapping as below but this is also not doing anything. Probably, the XSL has to be modified to use in my case . Please help. and let me know.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<ns:Product_MT xmlns:ns="urn:alpha:websub">
<xsl:copy-of select="." />
</ns:Product_MT>
</xsl:template>
</xsl:stylesheet>
thx
mike
Try the following -
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:ns="urn:alpha:websub" version="1.0">
<xsl:output encoding="UTF-8" indent="yes" method="xml" version="1.0"/>
<xsl:variable name="root">Product_MT</xsl:variable>
<xsl:template match="*">
<xsl:choose>
<xsl:when test="local-name()=$root">
<xsl:element name="ns:{local-name()}">
<xsl:apply-templates select="node()"/>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:element name="{local-name()}">
<xsl:apply-templates select="node()"/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Regards,
Sameej
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Sameej. This works in XMLSPY but not in PI Operation mapping
I am getting the error as
javax.xml.transform.TransformerException: java.lang.RuntimeException: Namespace for prefix 'ns' has not been declared. |
My source structure has ns1 namespace and it should work according to XMLSPY test but not working in PI ..any help? anyone?
mike
I had to tweak the XSL little bit to make it work in PI. See updated version below -
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output encoding="UTF-8" indent="yes" method="xml" version="1.0"/>
<xsl:variable name="root">MT_Product</xsl:variable>
<xsl:variable name="rootns">urn:mdt:udiwebsubmission</xsl:variable>
<xsl:template match="*">
<xsl:choose>
<xsl:when test="local-name()=$root">
<xsl:element name="ns:{local-name()}" namespace="{$rootns}">
<xsl:apply-templates select="node()"/>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:element name="{local-name()}">
<xsl:apply-templates select="node()"/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Regards,
Sameej
thx a ton Sameej. you resolved the issue. I'm doing a operation mapping wherein I have to place this XSL as the 2nd mapping and first would be message mapping. The other way is not working because it just removes the ns namespace from the final target message after the message mapping.
thx again
mike
What is the value you have given for accept namespace?
it should be urn:alpha:websub ns
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.