【发布时间】:2011-07-08 14:35:17
【问题描述】:
我正在使用 spring,并且在我的客户端(一个 Web 应用程序)中,我需要与 Jax-WS Web 服务进行交互。我目前通过使用 @WebServiceRef 注释注释服务接口来工作。但是,我需要注入 wsdlLocation 属性,因为显然 Sun Microsystems 或 Oracle,生产中的 Web 服务 wsdl 位置将不同于开发期间使用的位置。
如何注入 wsdlLocation?
这是一个极其简化的代码版本:
//This client service lives in the web app. wsimport used to generate artifacts.
@Component
public class MyClientServiceImpl implements MyClientService {
@WebServiceRef(wsdlLocation = "http://localhost:8080/ws/MyOtherService/the.wsdl", value = MyOtherServiceService.class)
//Interface generated by wsimport
private MyOtherService otherService;
@Override
public List<SomeSearchData> search(String searchString) {
return otherService.search(searchString);
}
}
【问题讨论】:
标签: java web-services jax-ws