Apache ServiceMix!请求重播Web服务消息

时间:2014-03-05 14:53:17

标签: web-services soap cxf apache-camel soapui

您好!

我试图学习一些Apache CamelApache CXF,当然我遇到了一些问题。

我想做的事情:

将定时SOAP消息从ESB发送到某个Web服务,等待来自Web服务的响应并进行处理。我正在使用Apache ServiceMix!。

我做了什么:

实现了一个WSDL文件,其中包含两个操作PingOutput(我发送的内容)和PingInput(我希望从WS接收的内容)。

实现了一个CXF端点(http://127.0.0.1:8090/ping_ws是一个用SoapUI模拟的WS):

<cxf:cxfEndpoint address="http://127.0.0.1:8090/ping_ws"
                 id="Ping_Mocked_WS" wsdlURL="ping.wsdl">
    <cxf:properties>
        <entry key="dataFormat" value="PAYLOAD" />
    </cxf:properties>
</cxf:cxfEndpoint>

实施了Camel路线:

<camelContext xmlns="http://camel.apache.org/schema/spring" streamCache="true">
    <route id="ping-ws">
        <from uri="timer://ping_timer?fixedRate=true&amp;period=10000"/>
        <bean ref="PingBean" method="createPingRequest" />
        <to uri="cxf:bean:Ping_Mocked_WS"/>
        <bean ref="PingBean" method="processPingResponse" />
    </route>
</camelContext>

我不明白:

  1. 为什么<bean ref="PingBean" method="processPingResponse" />从SoapUI(WSDL中定义的PingOutput操作)获得正确的响应?
  2. 这是实现目标的正确方法吗?通过这种方式,我的意思是一条路线?
  3. 代码工作正常,我可能在这里有一些拼写错误,请不要介意。

    谢谢!

1 个答案:

答案 0 :(得分:1)

广告1)

可能因为processPingResponse方法的方法签名中定义的类型。 Camel使用bean参数绑定,并根据类型,使用其类型转换器转换为给定的类型。

由于有效负载是XML中的SOAP响应,因此可以使用JAXB将XML从方法签名转换为类型。

为此,它使用了ServiceMix开箱即用的camel-jaxb。

Ad2的) 路线有效。你想以不同的方式做什么?

相关问题