3

CamelとCXFを使用してWebサービスを開発しており、「コードファースト」アプローチを使用しています。単一のパラメーターを持つメソッドの場合、すべてが正常に機能します。ただし、複数のパラメーターを持つメソッドは最初のパラメーターのみを受け取り、他のパラメーターは null に解決されます。例外はスローされません。

これが私のルートです:

<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

requestwrapper アノテーションを使用する必要があると思います。cxf の wsdl_first の例で生成されたコードを見てください。注釈と適切なラッパー クラスを生成します。

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

于 2012-04-12T05:44:38.693 に答える