posted 14 years ago
Well I can now access the remote secure Web Service, using our Java client and our JKS file. To conclude this topic for others:
1) Make sure server-side everything is set up correctly. Our business partner is still developing and configuring the WS, which I assumed was not the case so I kept asking myself what could be the problem.
2) I have the connection working with SoapUI. Make sure to set SoapUI preferences correctly, such as Http version and Proxy settings. Configure SoapUI project with client certificate file (JKS, PFX, ...), make sure pw is correct. Also make sure to specify the certificate in the SSL section of the request properties.
3) Create a truststore file containing the server-side certificate using keytool:
Optionally when you have a pfx file instead of jks, you can convert the pfx to jks using:
4) I used METRO/JAX-WS command wsimport to create WS src files like so:
5) I used this code to first establish a handshake, where
* certificateFile is of type java.io.File and is the full absolute path+filename to our client JKS cert,
* truststoreFile is of type java.io.File and is the full absolute path+filename to our generated truststore file,
* certificatePassword and trustStorePassword are both strings containing the appropriate passwords,
* socketHost is the hostname of the service, typically the domain part of the soap address location in the WSDL, without protocol, e.g.: ws.domain.com,
* socketPort is the port of the service, in our case 443:
6) I use code like this to call the web service (pseudo code):
This concludes just about all I have done to get it working. I would like to thank you, Srini, for all your information and taking the time to help!
Kind regards,
Kjeld Sigtermans
Kjeld Sigtermans - SCJP 1.4 - SCWCD 1.4