【问题标题】:How to use Choice Pattern over Soap Request in Mule ESB?如何在 Mule ESB 中使用选择模式而不是 Soap 请求?
【发布时间】:2016-11-29 00:43:57
【问题描述】:

我有一个接受 Soap 请求的端点,在这个端点之后,它会转到一个 Transform Message,它会生成对外部 Web 服务的适当请求。 我想要做的是使用 选择模式 来决定我必须重定向到哪个外部 Web 服务。

<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
<cxf:configuration name="CXF_Configuration" enableMuleSoapHeaders="true" initializeStaticBusInstance="true" doc:name="CXF Configuration"/>
<ws:consumer-config name="Web_Service_Consumer" service="KarmaService" port="KarmaPort" serviceAddress="http://localhost:8080/TestingWS/Karma" wsdlLocation="http://localhost:8080/TestingWS/Karma?wsdl" doc:name="Web Service Consumer"/>
<flow name="testingChoice">
    <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
    <cxf:proxy-service configuration-ref="CXF_Configuration" payload="body" doc:name="CXF"/>
    <dw:transform-message doc:name="Transform Message">
        <dw:set-payload><![CDATA[%dw 1.0
    %output application/xml
    %namespace ns0 http://karmapackage/
    ---
    {
       ns0#sayHello: {
      arg0: payload.invoke.arg0
    }
    }]]></dw:set-payload>
    </dw:transform-message>
    <choice doc:name="Choice">
        <when expression="#[payload]">
            <logger message="Info1" level="INFO" doc:name="Logger"/>
        </when>
        <otherwise>
            <logger message="Default" level="INFO" doc:name="Logger"/>
        </otherwise>
    </choice>
    <ws:consumer config-ref="Web_Service_Consumer" operation="sayHello" doc:name="Web Service Consumer"/>
    <logger message="Andando" level="INFO" doc:name="Logger"/>
</flow>

现在,Choice 正在重定向到 Logger 信息,只是为了知道它在做什么。 例如,我不知道如何在 when 条件上设置 表达式 以检查 arg0 是否具有值 choosePath1

如果有任何帮助,我将不胜感激, 提前致谢

【问题讨论】:

    标签: soap mule esb choice


    【解决方案1】:

    查看这篇文章,根据转换后的 xml 编写 xpath 表达式。 Mule 3.4.0 Choice router based on presence of a node in payload using Xpath

    同时检查如何在 mule 文档上构建 xml xpath

    https://docs.mulesoft.com/mule-user-guide/v/3.8/xpath

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-08-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-31
      相关资源
      最近更新 更多