WSO2 ESB 4.7 - 变压器代理错误

时间:2013-12-11 22:06:17

标签: wso2esb

我已使用XSLT配置了Transformer Proxy。我的XSLT表达式已经过测试,它们是正确的。但是"意外的子元素{http://tempuri.org/hello1}值"发生错误。请帮我解决这个问题。

代理

 <proxy name="testProxy" transports="http" startOnLoad="true" trace="disable">
      <target>
         <endpoint>
            <address uri="http://localhost:8080/axis2/services/hello2"/>
         </endpoint>
         <inSequence>
            <log level="full"/>
            <xslt key="req"/>
         </inSequence>
         <outSequence>
            <log level="full"/>
            <xslt key="res"/>
            <send/>
         </outSequence>
      </target>
   </proxy>

   <localEntry key="res" src="file:repository/resources/test/res.xsl"/>
   <localEntry key="req" src="file:repository/resources/test/req.xsl"/>

esb log

[2013-12-12 03:25:58,904]  INFO - LogMediator To: /services/testProxy, WSAction: sayHello, SOAPAction: sayHello, MessageID: urn:uuid:aef12421-abad-4a87-ba7b-4c13012a4a4a, Direction: request, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ns1:value xmlns:ns1="http://tempuri.org/hello1">Peter</ns1:value></soapenv:Body></soapenv:Envelope>
[2013-12-12 03:25:58,916]  INFO - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:43cc7c61-29ee-4827-ba5e-735af5ecbd00, Direction: response, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><soapenv:Fault><soapenv:Code><soapenv:Value>soapenv:Receiver</soapenv:Value></soapenv:Code><soapenv:Reason><soapenv:Text xml:lang="en-US">org.apache.axis2.databinding.ADBException: Unexpected subelement {http://tempuri.org/hello1}value</soapenv:Text></soapenv:Reason><soapenv:Detail/></soapenv:Fault></soapenv:Body></soapenv:Envelope>

req.xsl

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"
xmlns:ns1="http://tempuri.org/hello1"
xmlns:ns2="http://tempuri.org/hello2">

    <xsl:output method="xml" indent="yes"/>

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

    <xsl:template match="/soapenv:Envelope/soapenv:Body/ns1:value">
        <ns2:stringValue>
            <xsl:value-of select="normalize-space(.)" />
        </ns2:stringValue>              
    </xsl:template>

</xsl:stylesheet>

res.xsl

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"
xmlns:ns1="http://tempuri.org/hello1"
xmlns:ns2="http://tempuri.org/hello2">

    <xsl:output method="xml" indent="yes"/>

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

    <xsl:template match="/soapenv:Envelope/soapenv:Body/ns2:stringValue">
        <ns1:value>
            <xsl:value-of select="normalize-space(.)" />
        </ns1:value>              
    </xsl:template>

</xsl:stylesheet>

1 个答案:

答案 0 :(得分:0)

soap soap是你的端点的响应,你应该在你的inSequence中<xslt key="req"/>之后添加一个log level =“full”来查看你发送的内容