Hi All,

I want to add a namespace prefix to the 'detail' element of the fault
message sent by the Fault Mediator. I have used an XSLT mediator for this
purpose but the transformation is not applying to the detail element.

*XSLT (prefixSet.xslt)*

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:ns0="
http://abc.com/"; version="1.0">
 <xsl:output omit-xml-declaration="yes" indent="yes"></xsl:output>
 <xsl:strip-space elements="*"></xsl:strip-space>

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

 <xsl:template match="*">
  <xsl:element name="ns0:{name()}" namespace="http://abc.com/";>
   <xsl:copy-of select="namespace::*"></xsl:copy-of>
       <xsl:apply-templates select="node()|@*"></xsl:apply-templates>
  </xsl:element>
 </xsl:template>
</xsl:stylesheet>

*Proxy configuration:*

<proxy xmlns="http://ws.apache.org/ns/synapse"; name="Test2"
transports="https,http" statistics="disable" trace="disable"
startOnLoad="true">
    <target>
        <inSequence>
            <makefault version="soap11" response="true">
                <code xmlns:soap11Env="
http://schemas.xmlsoap.org/soap/envelope/";
value="soap11Env:VersionMismatch"/>
                <reason value="Testing the Fault Message"/>
                <role/>
                <detail
expression="/*[local-name()='Envelope']/*[local-name()='Body']/*"/>
            </makefault>
             <xslt key="prefixSet" source="//detail"/>
            <log level="full">
                <property name="result" value="******************Fault
Message *****************"/>
            </log>
            <send/>
        </inSequence>
    </target>
    <description/>
</proxy>

*SOAP request :*

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
   <soapenv:Header/>
   <soapenv:Body>
    <data xmlns="http://abc.xom"; />
   </soapenv:Body>
</soapenv:Envelope>

*Expected Output:*


<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
">
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode xmlns:soap11Env="
http://schemas.xmlsoap.org/soap/envelope/";>soap11Env:Server</faultcode>
         <faultstring>Testing the Fault Message</faultstring>
         <detail>
            <ns0:data xmlns:ns0="http://abc.com"/>
         </detail>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>

But the transformation is not getting applied and I am getting the response
as follows.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode xmlns:soap11Env="
http://schemas.xmlsoap.org/soap/envelope/
">soap11Env:VersionMismatch</faultcode>
         <faultstring>Testing the Fault Message</faultstring>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>

The xslt is correct since I have tested this with a simple SOAP request and
it's getting applied but the problem is I am unable to apply this to the
detail element of the fault message.

Can someone point what I have done wrong in here?

Thanks,
Sohani
Sohani Weerasinghe
Software Engineer
WSO2, Inc: http://wso2.com

Mobile  : +94 716439774
Blog     :http://christinetechtips.blogspot.com/
Twitter  : https://twitter.com/sohanichristine
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to