我使用spring,並且在我的客戶端,一個web應用程序中,我需要與Jax-WS webservice進行交互。我現在通過使用@WebServiceRef註釋來註釋服務接口來工作。但是,我需要注入wsdlLocation屬性,因爲很明顯,Sun Microsystems或Oracle,生產中的Web服務wsdl位置將與開發期間使用的位置不同。Spring:如何在@WebServiceRef中注入wsdlLocation
如何注入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);
}
}
這在這種情況下不起作用。 Web服務注入了@WebServiceRef註釋。我從不直接與wsimport生成的服務實現類交互。 –