Before the change, the request will like below.
<ns0:getRelatedContacts xmlns:ns0="http://ws.crm.victor.com" xmlns:ns1="http://lib.ws.victor.com">
<ns0:contactRequest>
<ns1:FAID>FAID_1</ns1:FAID>
<ns1:subscriptionId>subscriptionId_1</ns1:subscriptionId>
</ns0:contactRequest>
</ns0:getRelatedContacts>
<ns0:getRelatedContacts xmlns:ns0="http://ws.crm.victor.com" xmlns:ns1="http://lib.ws.victor.com">
<contactRequest>
<ns1:FAID>FAID_1</ns1:FAID>
<ns1:subscriptionId>subscriptionId_1</ns1:subscriptionId>
</contactRequest>
</ns0:getRelatedContacts>
Definitely, there isn't a out-box solution. We have to create some code by ourselves to resolve this specific issue.
For replacing namespace, it is pretty simple with XSLT and can be done by a element copy. The next issue is to find out the second level element in the request to remove the namespace and adding the namespace back in response.
Here are the code for removing namespace from request.
<xsl:stylesheet version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="*[count(ancestor::node())=2]">
<xsl:element name="{local-name()}">
<xsl:copy-of select="@*"/>
<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>
<xsl:stylesheet version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="*[count(ancestor::node())=2]">
<xsl:element name="{local-name()}" namespace="{namespace-uri(parent::node())}">
<xsl:copy-of select="@*"/>
<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>
No comments:
Post a Comment