Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Won't Fix or Usage Issue
-
Affects Version/s: 2.2
-
Fix Version/s: None
-
Component/s: Modules: CXF
-
Labels:
-
Environment:
Appservers: Jetty, Websphere 6.1
OS: Windows XP
-
User impact:High
-
Configuration:
-
Log Output:
-
Similar Issues:None
Description
I am proxying a remote webservice using Mule/CXF. The XSI namespace in the response SOAP message from the remote webservice is getting changed from:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
to:
xmlns:xsi="xsi"
This results in the following error on the client side when calling the proxy:
Caused by: com.ctc.wstx.exc.WstxParsingException: Undeclared namespace prefix "xsi" (for attribute "nil")
at [row,col {unknown-source}]: [1,1601]
I have been able to confirm that Mule/CXF is inserting the incorrect XSI namespace, not the remote web service. When I call the remote service directly using SoapUI the XSI namespace is correct.
It is of note that a similar problem seems to be occuring with Service Mix, so this may be a problem with CXF itself.
I have tried to change the namespace in the resulting message using an XSL stylesheet but have so far been unsuccessful.
Issue Links
- is blocked by
-
MULE-4157
Support sending whole SOAP Envelope with CXF proxies
-
I was able to work around this issue using the XSL stylesheet below as a response transformer on the <cxf:outbound-endpoint>.
The stylesheet essentially copies all of the elements without ANY attributes (including namespace attributes), and re-writes the <soap:Envelope> to ensure that the namespaces from the stylesheet are applied to it.
It's not ideal by any means, but it works.
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns="http://mydomain.com">
<xsl:output omit-xml-declaration="yes" indent="yes" />
<!-- identity template without namespace nodes -->
<xsl:template match="*">
<xsl:element name="{name()}">
<xsl:apply-templates select="@*|node()" />
</xsl:element>
</xsl:template>
<!-- The lack of '@*' means attributes are stripped. -->
<xsl:template match="text()|comment()|processing-instruction()">
<xsl:copy>
<xsl:apply-templates select="node()" />
</xsl:copy>
</xsl:template>
<!-- This will ensure that the Soap:Envelope element gets the namespaces from this stylesheet -->
<xsl:template match="soap:Envelope">
<soap:Envelope>
<xsl:apply-templates select="*" />
</soap:Envelope>
</xsl:template>
</xsl:stylesheet>