WebServices + Certificat + Proxy
Bonjour,
je débute dans les webservices et je dois faire une application client en java qui me permet de m'y connecter. Dans cette appli je dois sortir par mon proxy, faire la connexion SSL à l'aide d'un certificat fourni, passer l'authentication Basic puis récupérer le résultat de ma requête sur le service.
Voilà ce que j'ai reçu par mon hôte qui héberge les webservices auxquels je dois accèder (et qui ne fait évidement aucun support ou aide pour leur accès...) :
- L'URL du service (https://www.myurl.com/getmyservice?PARAM=toto)
- Le certificat (format xxxx.p12)
- Mon UserID et password pour l'authentication Basic
Mais hélas aucun fichier WSDL (qui m'aurait bien facilité la tâche).
J'ai fait pas mal de recherche pour ma connexion, mais les exemples que j'ai trouvé n'ont pas été fructifiant... Le problème étant ce certificat que je n'arrive pas à utiliser.
Voilà le code de connexion que j'ai :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
//Création de l'accès vers le service
Service service = new Service();
//Création d'un appel vers le service
Call call = (Call)service.createCall();
//Récupération de l'adresse URL du service accédé
call.setTargetEndpointAddress(new java.net.URL(endpoint));
//Informer que je passe par le proxy
System.getProperties().put("https.proxySet", "true" );
System.getProperties().put("https.proxyHost", proxyHost);
System.getProperties().put("https.proxyPort", proxyPort);
System.setProperty("javax.net.ssl.trustStore", CertificatPath );
System.setProperty("javax.net.ssl.trustStoreType", "PKCS12" );
System.setProperty("javax.net.ssl.trustStorePassword", CertificatPassword );
//Invocation du service & Récupération du résultat
String message = (String)call.invoke("",new Object[]{});
System.out.println("Retour = " + message); |
et voilà l'erreur qui me saute au nez...
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
java.net.SocketException: Default SSL context init failed: IBMTrustManager: Problem accessing trust store java.io.IOException: Error in loading the keystore: Private key decryption error: (java.security.InvalidKeyException: Illegal key size)
---------------------------------------------
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.net.SocketException: Default SSL context init failed: IBMTrustManager: Problem accessing trust store java.io.IOException: Error in loading the keystore: Private key decryption error: (java.security.InvalidKeyException: Illegal key size)
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:java.net.SocketException: Default SSL context init failed: IBMTrustManager: Problem accessing trust store java.io.IOException: Error in loading the keystore: Private key decryption error: (java.security.InvalidKeyException: Illegal key size)
at javax.net.ssl.DefaultSSLSocketFactory.createSocket(SSLSocketFactory.java:8)
at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:178)
at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191)
at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:2391)
at Form_WS.main(Form_WS.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at org.eclipse.ve.internal.java.vce.launcher.remotevm.JavaBeansLauncher.main(JavaBeansLauncher.java:79)
{http://xml.apache.org/axis/}hostname:MyComputerName |
Est-ce que qqun saurait m'aider? Merci d'avance...