-
Mar 11th, 2009, 09:10 AM
#1
How to configure Spring WebService Client for SSL communication
Hi All,
I am trying to communicate with an HTTPS sever who has exposed some webservices.
I have used spring-ws to create a simple WebServiceClient which internally uses org.springframework.ws.client.core.WebServiceTempl ate. I have injected the defaultURI to the WebServiceClient in spring-config.xml.
<bean id="WebServiceClient" class="com.rbos.dolphin.casm.service.dms.WebServic eClient">
<property name="defaultUri" value="https://server
ort/Login"/>
</bean>
Inside the WebServiceClient the code is like this:
public class WebServiceClient {
private final WebServiceTemplate webServiceTemplate = new WebServiceTemplate();
public void setDefaultUri(String defaultUri) {
webServiceTemplate.setDefaultUri(defaultUri);
}
// send to the configured default URI
public void simpleSendAndReceive(StreamSource source, StreamResult result) {
webServiceTemplate.sendSourceAndReceiveToResult(so urce, result);
}
}
I am getting an exception at webServiceTemplate.sendSourceAndReceiveToResult:
--------------------------------------------------------------------------------------------
I/O error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderE xception: unable to find valid certification path to requested target; nested exception is javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderE xception: unable to find valid certification path to requested target
org.springframework.ws.client.WebServiceIOExceptio n: I/O error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderE xception: unable to find valid certification path to requested target; nested exception is javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderE xception: unable to find valid certification path to requested target
at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:508)
at org.springframework.ws.client.core.WebServiceTempl ate.doSendAndReceive(WebServiceTemplate.java:457)
at org.springframework.ws.client.core.WebServiceTempl ate.sendSourceAndReceiveToResult(WebServiceTemplat e.java:403)
at org.springframework.ws.client.core.WebServiceTempl ate.sendSourceAndReceiveToResult(WebServiceTemplat e.java:394)
at org.springframework.ws.client.core.WebServiceTempl ate.sendSourceAndReceiveToResult(WebServiceTemplat e.java:384)
at com.rbos.dolphin.casm.service.dms.WebServiceClient .simpleSendAndReceive(WebServiceClient.java:22)
at com.rbos.dolphin.casm.dms.DMSServiceTest.testWebSe rviceClient(DMSServiceTest.java:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at junit.framework.TestCase.runTest(TestCase.java:154 )
Can someone help me to find out how to configure the trust with the https server. There are plenty of documents but I am not sure which path to follow. I simply want to trust that website by accepting whatever certificate it gives me.
Any help/Direction is highly appreciated.
Last edited by Debjani; Mar 11th, 2009 at 11:52 AM.
Reason: TO provide the whole stack trace
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules