我可以在 ESB 代理 (WSO2) 中使用两个以上的 XSLT 转换吗?有限制吗?
Can I use more than two XSLT transformation in a ESB Proxy (WSO2)? There is a limit for that?
我需要在我的 ESB 代理 (Wso2) 中使用 3 个 XSLT 转换,但它不起作用。
当我尝试使用 2 个 XSLT 和 1 个有效载荷工厂(而不是第二个 XSLT)时,代理工作正常:执行第一个 XSLT,调用第一个服务,执行第二个 XSLT,调用第二个服务,执行第三个 XSLT 和正确响应,结束流程。
但是当我更改此 Payload Factory 以进行 XSLT 转换时,代理执行第一个 XSLT,调用第一个服务,执行第二个 XSLT,跳过第二个调用并尝试执行第三个 XSLT,但停止工作。
如果我查看我的日志文件,它表明服务器正在正确执行转换(我放了一些日志来查看,转换是正确的)。所以,我相信我的转变是正确的。
我的代理 link 是:
<proxy name="Proxy1" startOnLoad="true" trace="disable" transports="http https" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<xslt key="conf:transformation/TransformSubmitPartnerRequestToFirstExternalServiceRequest.xsl" source="//SubmitPartnerRequest">
</xslt>
<call>
<endpoint key="FirstExternalServiceEndpoint"/>
</call>
<xslt key="conf:transformation/transformFirstExternalServiceResponseToSecondExternalServiceRequest.xsl" source="//FirstExternalServiceResponse">
</xslt>
<call>
<endpoint key="CLMServiceEndpoint"/>
</call>
<send/>
</inSequence>
<outSequence>
<xslt key="conf:transformation/transformSecondExternalServiceResponseToSubmitPartnerResponse.xsl" source="//SecondExternalServiceResponse"/>
<send/>
</outSequence>
<faultSequence/>
</target>
<publishWSDL key="gov:wsdl/ServiceV1.wsdl">
<resource key="gov:wsdl/Information.xsd" location="./Information.xsd"/>
</publishWSDL>
</proxy>
我的转换示例:
<!-- First transformation: TransformSubmitPartnerRequestToFirstExternalServiceRequest.xsl -->
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
<xsl:template match="//SubmitPartnerRequest">
<Request>
<!-- info here... -->
</Request>
</xsl:template>
</xsl:stylesheet>
我的代码有问题吗?
我可以在我的 ESB 代理中使用 2 个以上的 XSLT 转换吗?
在你的序列中,我们可以找到:
- xslt
- 调用端点
- xslt
- 调用端点
- 发送 --> 这个没有任何端点的发送将把当前消息作为响应发回
不应执行您的 outSequence :删除它并在最后发送中介之前在 inSequence 中添加它的 xslt
我试图将属性发送到我的第二个 XSLT 转换,这就是问题所在。
我更改了它,现在我的代理可以正常工作了。
我需要在我的 ESB 代理 (Wso2) 中使用 3 个 XSLT 转换,但它不起作用。
当我尝试使用 2 个 XSLT 和 1 个有效载荷工厂(而不是第二个 XSLT)时,代理工作正常:执行第一个 XSLT,调用第一个服务,执行第二个 XSLT,调用第二个服务,执行第三个 XSLT 和正确响应,结束流程。
但是当我更改此 Payload Factory 以进行 XSLT 转换时,代理执行第一个 XSLT,调用第一个服务,执行第二个 XSLT,跳过第二个调用并尝试执行第三个 XSLT,但停止工作。
如果我查看我的日志文件,它表明服务器正在正确执行转换(我放了一些日志来查看,转换是正确的)。所以,我相信我的转变是正确的。
我的代理 link 是:
<proxy name="Proxy1" startOnLoad="true" trace="disable" transports="http https" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<xslt key="conf:transformation/TransformSubmitPartnerRequestToFirstExternalServiceRequest.xsl" source="//SubmitPartnerRequest">
</xslt>
<call>
<endpoint key="FirstExternalServiceEndpoint"/>
</call>
<xslt key="conf:transformation/transformFirstExternalServiceResponseToSecondExternalServiceRequest.xsl" source="//FirstExternalServiceResponse">
</xslt>
<call>
<endpoint key="CLMServiceEndpoint"/>
</call>
<send/>
</inSequence>
<outSequence>
<xslt key="conf:transformation/transformSecondExternalServiceResponseToSubmitPartnerResponse.xsl" source="//SecondExternalServiceResponse"/>
<send/>
</outSequence>
<faultSequence/>
</target>
<publishWSDL key="gov:wsdl/ServiceV1.wsdl">
<resource key="gov:wsdl/Information.xsd" location="./Information.xsd"/>
</publishWSDL>
</proxy>
我的转换示例:
<!-- First transformation: TransformSubmitPartnerRequestToFirstExternalServiceRequest.xsl -->
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
<xsl:template match="//SubmitPartnerRequest">
<Request>
<!-- info here... -->
</Request>
</xsl:template>
</xsl:stylesheet>
我的代码有问题吗? 我可以在我的 ESB 代理中使用 2 个以上的 XSLT 转换吗?
在你的序列中,我们可以找到:
- xslt
- 调用端点
- xslt
- 调用端点
- 发送 --> 这个没有任何端点的发送将把当前消息作为响应发回
不应执行您的 outSequence :删除它并在最后发送中介之前在 inSequence 中添加它的 xslt
我试图将属性发送到我的第二个 XSLT 转换,这就是问题所在。
我更改了它,现在我的代理可以正常工作了。