java - Spring Webservice 客户端不返回任何数据
问题描述
要在我们的 Spring Web 应用程序中使用 Web 服务,我遵循以下说明:使用 JaxWsPortProxyFactoryBean 调用 Web 服务
我已经使用 wsimport 生成了客户端类,并且可以在命令行客户端中使用这些类。一切正常。
public static void main(String[] args) {
OrderServiceRequest req = new OrderServiceRequest()
// set fields
req.setLoginId('test');
ProfileService profileService = new ProfileService();
ProfileSoap port = profileService.getProfileSoap12();
OrderServiceResponse response = port.orderServiceRequest(req);
System.out.println("ErrorCode=" + response.getErrorCode());
}
我在 Spring 中使用生成的类实现了一项服务。我将服务配置为 Spring Bean:
<bean id="myService" class="org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean">
<property name="serviceInterface" value="my.package.name.ProfileSoap" />
<property name="wsdlDocumentUrl" value="http://localhost:9999/connector/MyWebService?wsdl" />
<property name="namespaceUri" value="http://url.to.namespace" />
<property name="serviceName" value="ProfileService" />
<property name="endpointAddress" value="http://localhost:9999/connector/MyWebService" />
</bean>
在另一个服务中,我注入服务并调用 web 服务:
@Autowired
@Qualifier("myService")
ProfileSoap myService;
OrderServiceRequest req = new OrderServiceRequest();
req.setLoginId("12345");
req.setPassword("test");
req.setEAN("9783864905254");
// Request
OrderServiceResponse response = myService.orderServiceRequest(req);
// all fields of the response are null!
System.out.println(response.getErrorCode());
使用 Eclipse 中的 TCP-Monitor,我可以看到响应返回了正确的数据,但服务中的 Response-Object 没有数据。
我应该采取什么方法来调试这个问题?任何帮助表示赞赏
解决方案
推荐阅读
- javascript - Ajax 在等待 d3 graphs/.json 响应时加载图形?(导轨)
- python - Python:将图像和数据帧写入同一个 excel 文件
- ms-access - VBA Intellisense 未激活
- ms-access - 访问 - 从 VBA 调用查询与直接执行
- javascript - 比较对象内的键值是否重复
- android - 我应该让 LiveData 或 Repository 类的 AsyncTask 成员 - 作为 Loader 的替代品
- python - Python中的多列编码
- javascript - 在 React 中显示模态的最佳方式
- mysql - 在 SQL 的 SELECT 语句中组合 CONCAT
- database - odoo 域搜索“id 中的 id”