【发布时间】:2010-10-04 19:46:15
【问题描述】:
我有两个代码项目都使用 CXF 来使用 Web 服务。当我从项目 A 调用项目 B 时,我正在调用的方法接收空参数。我打开了日志记录,入站消息确实包含正确的参数。我还尝试从 SoapUI(一种网络服务测试工具)调用我的服务。正如我所料,这会传递参数。有人知道出了什么问题吗?
服务接口:
@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 注释
- 以编程方式配置
- Aegis 数据绑定(JAXWS 不喜欢接口)
【问题讨论】:
-
你是怎么配置的?哪个数据绑定? @Name 是什么?
-
我已在最后添加了您要求的信息。
-
简单的前端,然后呢?它不会尊重那些 @WebService 注释。恐怕这对 cxf 用户会更好。这不是简单的“我可以回答你的问题”之类的事情,而是一个扩展的诊断练习。
-
很遗憾这个问题的答案没有在这里发布,因为我刚才遇到了同样的问题。
-
@Tim 我认为我没有找到原因,但我相信这与使用 @WebParam 注释有关。接收方期待带有集合名称的结果,而这不是我在 @WebParam 注释中的结果,它期待 arg0、arg1 等。当我删除 @WebParam 时,我相信它有效。
标签: java web-services cxf