我有一个WSDL,它正在导入另一个WSDL。我想从Java客户端代码调用web服务,我已经配置了我的Java类如下
package test;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.oxm.jaxb.Jaxb2Marshaller;
@Configuration
public class WeConfig {
@Bean
public Jaxb2Marshaller marshaller() {
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
marshaller.setContextPath("test");
return marshaller;
}
@Bean
public WeatherClient1 weatherClient(Jaxb2Marshaller marshaller) {
WeatherClient1 client = new WeatherClient1();
client.setDefaultUri("*******");
client.setMarshaller(marshaller);
client.setUnmarshaller(marshaller);
return client;
}
}
我的访问方法如下
GetDataResponse response = (GetDataResponse) getWebServiceTemplate()
.marshalSendAndReceive(
"*******",
request,
new SoapActionCallback("*******"));
我的webservice应该是类似于
https://abcde.handling.com/celebrity/Confi?wsdl
请让我知道,我必须在配置和soapcallbackaction setdefaultUri输入什么。soap Ui为请求提供了一个方法"GetData"提前感谢……
经过长时间的挣扎,这个查询的答案将如下;
DefaultUri =(完整WSDL) https://abcde.handling.com/celebrity/Confi?wsdl
我的请求没有回叫操作,所以:
GetDataResponse response = (GetDataResponse) getWebServiceTemplate().marshalSendAndReceive ("导入wsdl的URI",请求);