Apache Camel + spring remoting + jax-ws +多个参数

时间:2014-04-10 11:23:44

标签: spring jax-ws apache-camel

我有跟随骆驼路线:

<route id="myRoute">
   <from uri="cxf:bean:TestEndpoint />
   <process ref="TestProcessor" />
   <to uri="bean:TestWS?method=doSomething" />
</route>

TestWS:

<bean id="TestWS" class="org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean">
    <property name="serviceInterface" value="org.example.TestWS />
    <property name="wsdlDocumentUrl" value="http://localhost:8080/TestWSImplService/TestWSImpl?wsdl" />
    <property name="namespaceUri" value="http://org.example" />
    <property name="serviceName" value="TestWSImplService" />
    <property name="portName" value="TestWSImplPort" />
</bean>

和TestWS:

@WebService(targetNamespace = "http://org.example")
public interface TestWS {

    public String doSomething(Object param1, Object param2);
}

你能告诉我TestProcessor应该返回什么才能正确调用带有多个参数的TestWS吗?

由于

1 个答案:

答案 0 :(得分:1)

您需要将multiParameterArray=true选项添加到端点到bean [1] URI。

<to uri="bean:TestWS?method=doSomething&amp;multiParameterArray=true" />

然后您的处理器应将body设置为您要传递给服务的参数数组:

exchange.getIn().setBody(new Object[]{"param1", "param2"});

[1] https://camel.apache.org/bean.html