支持Mule SOAP服务中的多个操作

时间:2014-09-11 13:57:54

标签: web-services soap mule

为了实现自上而下的SOA,我创建了带有2个操作的WSDL并生成了Java类和接口。我创建了单个mule流来以下列方式处理多个操作。这是正确的方法还是更好的方法来实现它?

    <choice doc:name="Choice">
        <when expression="header:INVOCATION:cxf_operation={http://integration.sbs.com/Services/SMT/v1}getSupplierRequestDetail">
            <vm:outbound-endpoint exchange-pattern="request-response" path="GetFlow" doc:name="Get"/>
        </when>
        <when expression="header:INVOCATION:cxf_operation={http://integration.sbs.com/Services/SMT/v1}updateSupplierRequestDetail">
            <vm:outbound-endpoint exchange-pattern="request-response" path="UpdateFlow" doc:name="Update"/>
        </when>
        <otherwise>
            <logger message="Operation Not Supported" level="INFO" doc:name="Logger"/>
        </otherwise>

1 个答案:

答案 0 :(得分:0)

根据您不使用Service Class和其他Java代码的要求,该方法看起来没问题(只要服务按预期工作)。

其他选项如下。

WADL中的SOAP将定义其操作并定义操作请求。 在HTTP Inbound之后的流程中,您将收到SOAP Request XML。 因此,尝试使用请求XML上的选项来检查它是什么类型的请求,使用XPATH。 然后将请求路由到相应的流或子流。

<choice doc:name="Choice">
    <when expression="#[xpath('//mpsvc:getSupplierRequestDetail') != null">
        <vm:outbound-endpoint exchange-pattern="request-response" path="GetFlow" doc:name="Get"/>
    </when>
    <when expression="#[xpath('//mpsvc:updateSupplierRequestDetail') != null">
        <vm:outbound-endpoint exchange-pattern="request-response" path="UpdateFlow" doc:name="Update"/>
    </when>
     <otherwise>
        <logger message="Operation Not Supported" level="INFO" doc:name="Logger"/>
    </otherwise>
</choice>

希望这有帮助。

相关问题