簡體   English   中英

通過CXF進行的Web服務調用給出了空參數

[英]Web Service Call Via CXF Gives Null Parameters

我有兩個代碼項目都使用CXF來使用Web服務。 當我從項目A調用項目B時,我正在調用的方法將接收空參數。 我已打開日志記錄,入站消息確實包含正確的參數。 我還嘗試過從SoapUI(一種Web服務測試工具)調用我的服務。 如我所料,這會傳遞參數。 任何人有任何想法怎么了?

服務接口:

@WebService
public interface IShortlistService {

  public IShortlist createOrUpdateShortlist(@WebParam(name = "sessionId") String sessionId,
      @WebParam(name = "datastoreInstance") String datastoreInstance,
      @WebParam(name = "datastoreRecordId") String datastoreRecordId);
}

服務暗示:

@Name("shortlistService")
@WebService(endpointInterface = "com.oobjects.shortlist.service.IShortlistService", serviceName = "ShortlistService")
@Features(features = "org.apache.cxf.feature.LoggingFeature")
@Transactional
public class ShortlistService implements IShortlistService {
  public IShortlist createOrUpdateShortlist(String sessionId, String datastoreInstance,
      String datastoreRecordId) {
    // At this point all inputs are null
  }
}

記錄確認可以的入站消息:

INFO: Inbound Message
----------------------------
Encoding: UTF-8
Content-Type: text/xml; charset=UTF-8
Headers: {cache-control=[no-cache], content-type=[text/xml; charset=UTF-8], connection=[keep-alive], host=[mypc.mycompany.com:8080], content-length=[391], SOAPAction=[""], user-agent=[Apache CXF 2.2.5], Accept=[*/*], pragma=[no-cache]}
Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns1:createOrUpdateShortlist xmlns:ns1="http://service.shortlist.mycompany.com/"><sessionId>854a48b5-922f-4081-9c76-b6d08b58a341</sessionId><datastoreInstance>http://mypc.mycompany.com:8080/shortlist-app/services/ShortlistService</datastoreInstance></ns1:createOrUpdateShortlist></soap:Body></soap:Envelope>
--------------------------------------

CXF的版本相同(2.2.5)。 我想不出還要檢查什么!

一些要求的信息...

  • @Name是一個Seam批注
  • 以編程方式配置
  • 宙斯盾數據綁定(JAXWS不喜歡接口)

@Lee Theobald ...您發布的問題中沒有任何明顯的內容可以揭示為什么它不適合您。 在這種情況下,“答案”(例如)將請求“ CXF用戶”的幫助,並在必要時打開JIRA。 在問題注釋中播放20個問題的效率不是很高,此時,列表上的CXF專家眼球比這里要多得多。 揭開謎底后,我們可以在這里提出修改后的問題並回答。

好的,問題已解決為錯誤。 在部署他的服務之前,我正在使用其接口的那個人沒有從存儲庫中更新,並且由於他簽入但沒有部署的部分內容發生了變化(除去了throws子句),因此我使用了來自存儲庫。 他的界面版本引發了異常,但我的界面版本沒有這樣說。 所以:

如果服務提供者和服務客戶​​端使用略有不同的界面,則會發生此錯誤。

暫無
暫無

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

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