I am trying to consume SOAP Web Services in Springboot. so i am trying to hitting the request from SOAP UI and gettingthe error as below:
i have provided the Server point even getting the below error.
Error:
2018-06-12 15:40:03.725 INFO 2028 --- [nio-8088-exec-1] o.s.w.s.s.SaajSoapMessageFactory : Creating SAAJ 1.3 MessageFactory with SOAP 1.1 Protocol java.lang.IllegalArgumentException: 'uri' must not be empty at org.springframework.util.Assert.hasLength(Assert.java:233) at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:547) at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:390) at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:383)
Please find the code as below:
public class UserClientConfig extends WebServiceGatewaySupport {
public UserListResponse getUserList(UserList request) {
UserListResponse response = (UserListResponse) getWebServiceTemplate().marshalSendAndReceive( //here getting uri' must not be empty
request, new SoapActionCallback("http://*.*.WebServices/Services/UserList"));
return response;
}
}
@Configuration
@ComponentScan(basePackages = {"COM.*.*.Services"})
public class WSConfigClient {
@Bean
public Jaxb2Marshaller marshaller() {
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
marshaller.setContextPath("http://*.*.WebServices/Services");
return marshaller;
}
@Bean
public UserClientConfig UserClient(Jaxb2Marshaller marshaller) {
UserClientConfig client = new UserClientConfig();
client.setDefaultUri("http://....:8090/");//Server endpoint
client.setMarshaller(marshaller);
client.setUnmarshaller(marshaller);
return client;
}
}
@Endpoint
public class UserClientEndpoint {
private static Logger log = LogManager.getLogger(UserClientEndpoint.class);
UserClientResponse response = null;
@PayloadRoot(namespace = CteConstants.NAMESPACE_URI, localPart = "UserClient")
@ResponsePayload
public UserClientResponse UserClientRequest(@RequestPayload UserClient request) throws Exception {
try {
UserClientConfig client = new UserClientConfig();
response = client.getUserList(request);
}catch(Exception e) {
e.printStackTrace();
}
return response;
}
Can anyone please help on this.