3

我正在使用 Camel 和 CXF 开发 Web 服务,并使用“代码优先”方法。对于具有单个参数的方法,一切正常。然而,具有多个参数的方法只接收第一个参数,其他方法解析为空值。不会抛出异常。

这是我的路线:

<route>
  <from uri="cxf:bean:serverEndPoint" />
  <log message=">>> data is : ${body}"/>
  <choice>
    <when>
      <simple>${in.header.operationName} == 'doSomething'</simple>
      <to uri="bean:TestWSBean?method=doSomething"/>
    </when>
    ...
</route>

服务器端点定义如下:

<cxf:cxfEndpoint id="serverEndPoint"
               address="http://localhost:9000/casServer/"
               serviceClass="com.test.iface.TestWebService">
  <cxf:inInterceptors>
      <ref bean="loggingInInterceptor"/>
  </cxf:inInterceptors>                   
  <cxf:outInterceptors>
      <ref bean="loggingOutInterceptor"/>
  </cxf:outInterceptors>                   
</cxf:cxfEndpoint>

以及实现 bean 本身:

@WebService
public interface TestWebService {
  public String doSomething(String one, String two);
}

我的问题很基本,应该怎么做才能发送多个参数?

4

1 回答 1

2

我认为您将需要使用 requestwrappper 注释。查看 cxf 中 wsdl_first 示例生成的代码。它生成注释和合适的包装类。

@RequestWrapper(localName = "updateCustomer", targetNamespace = "http://customerservice.example.com/", className = "com.example.customerservice.UpdateCustomer")

于 2012-04-12T05:44:38.693 回答