Version 4.1 by Pascal Robert on 2007/09/03 19:42

Hide last authors
Pascal Robert 4.1 1 == SSL WebServices Problems ==
smmccraw 1.1 2
3 ~1. WOWebServiceClient class can't access to a secure HTTP Web service provider (WO 5.2.2):
4
5 Problem:
6 The com.webobjects.webservices.client.WOWebServiceClient class just throws exception like this one when it tries to read the WSDL from a secure HTTP Web service provider:
7
Pascal Robert 4.1 8 {{code}}
smmccraw 1.1 9
Pascal Robert 4.1 10 java.lang.IllegalArgumentException: Unable to open url:
11 https://localhost/cgi-bin/WebObjects/Test-Server.woa/ws/Test?wsdl
12 at com.webobjects.webservices.client.WOWebServiceClient.
13 initializeFromURL(WOWebServiceClient.java:72)
14 at com.webobjects.webservices.client.WOWebServiceClient.
15 <init>(WOWebServiceClient.java:59
smmccraw 1.1 16
Pascal Robert 4.1 17 {{/code}}
smmccraw 1.1 18
19 This problem doesn't seem related to self signed certificate, since I've performed tests with trusted certificate as well.
20
Pascal Robert 4.1 21 === Patrick Robinson ===
smmccraw 1.1 22
23 That's strange . . .
24
25 I had the same problem when I was trying to run both service and client on my development machine (which has only a self-signed cert), and specifying an HTTPS WSDL address. But after adding my cert to /Library/Java/Home/lib/security/cacerts:
26
Pascal Robert 4.1 27 {{code}}
smmccraw 1.1 28
Pascal Robert 4.1 29 cd /Library/Java/Home/lib/security
30 sudo keytool -import -keystore cacerts -alias myalias -file mycert.pem
smmccraw 1.1 31
Pascal Robert 4.1 32 {{/code}}
smmccraw 1.1 33
Pascal Robert 4.1 34 (The default password for the cacerts keystore is "changeit")
smmccraw 1.1 35
36 everything works fine.
37
38 I also had no trouble accessing either the WSDL or the service, via HTTPS, when the service was run on a system with a valid, trusted cert.
39
Pascal Robert 4.1 40 === Francis Labrie ===
smmccraw 1.1 41
Pascal Robert 4.1 42 It's finally not a real bug, thanks to Patrick Robinson and to the JAD tool. This exception is typically thrown when the server certificate is not trusted, i.e. the certificate is self-signed and not stored in the Java trusted keystore, or the hostname is not the same on the server and in the certificate, etc.
smmccraw 1.1 43
44 The problem is that the initializeFromURL() method of the com.webobjects.webservices.client.WOWebServiceClient class doesn't wrap and forward the catched exceptions, it only throws IllegalArgumentException with a simple " Unable to open url" or " Unable to create service from url" message, without any details.
45
Pascal Robert 3.1 46 To avoid such problem, just relax the Java security manager using code like one described here: [[How to Trust Any SSL Certificate>>Web Services-How to Trust Any SSL Certificate]].
smmccraw 1.1 47
Pascal Robert 4.1 48 === to Apple Documentation ===
smmccraw 1.1 49
Pascal Robert 4.1 50 [[http://developer.apple.com/documentation/WebObjects/Web_Services/Web_Services/chapter_4_section_3.html]]