将Mule ESB服务的请求传递给条件路由器

时间:2011-12-29 02:58:26

标签: esb mule

我正在使用Mule ESB公开CXF服务,我需要将请求传递给条件路由器。我看到的大多数示例都将响应传递给条件路由器。

如何在不更改wsdl的情况下传递请求?

2 个答案:

答案 0 :(得分:2)

当OP提供更多精确度时,我会修改这个答案

在实现您的网络服务的组件之后放置choice routing message processor

答案 1 :(得分:1)

我使用了Mule ESB 3提供的Web服务代理模式

<pattern:web-service-proxy name="theProxy" 
         outboundAddress="vm://theProxyFlow" 
        wsdlFile="classpath:wsdl/MyWsWSDL.wsdl" inboundAddress="${inbound.url}" transformer-refs="RequestToString">
</pattern:web-service-proxy>

VM端点实际上使用xpath表达式执行基于条件的路由。但是我必须编写一个“RequestToString”自定义转换器,以便我可以在传入的SOAP有效负载上应用xpath。

我在变压器中使用了以下转换 -

      if (src instanceof InputStream)
        {
            InputStream input = (InputStream) src;
            try
            {
                reqAsString = IOUtils.toString(input);
            }
            finally
            {
                IOUtils.closeQuietly(input);
            }
        }