簡體   English   中英

具有多個參數的CXF Web服務

[英]CXF web service with multiple parameters

我正在使用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);
}

我的問題非常基本,能夠發送多個參數應該怎么做?

我想你需要使用requestwrappper注釋。 看一下cxf中wsdl_first示例生成的代碼。 它生成注釋和合適的包裝類。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM