Hi,
Iīm trying to access a secure web service (thatīs in a SSL server) thought a proxy. But Iīm having problems. I downloaded the certificate from SSL server and save a file that contains the public key (.p7b). Then I installed the certificate in my JVM with this command:
keytool -import -trustcacerts -alias nciic -file c:\tools\nciicCertificate.cer -keystore C:\bea12\jrockit_160_29_D1.2.0-10\jre\lib\security\cacerts -storepass changeit
Then I put it in the java code:
String KEYSTORE_LOCATION = "C:/bea12/jrockit_160_29_D1.2.0-10/jre/lib/security/cacerts";
System.setProperty("javax.net.ssl.trustStore", KEYSTORE_LOCATION);
System.setProperty("javax.net.ssl.trustStorePasswo rd", "changeit");
And put the proxy configuration too:
AxisProperties.setProperty("http.proxyHost", proxyHost);
AxisProperties.setProperty("http.proxyPort", proxyPort);
AxisProperties.setProperty("http.proxyUser", "myUserName");
AxisProperties.setProperty("http.proxyPassword", "myPassword");
AxisProperties.setProperty("https.proxyHost", proxyHost);
AxisProperties.setProperty("https.proxyPort", proxyPort);
AxisProperties.setProperty("https.proxyUser", "myUserName");
AxisProperties.setProperty("https.proxyPassword", "myPassword");
Then I generate a Axis Stub that contains something like that:
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[6]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND _TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_ DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPCons tants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("https://api.nciic.org.cn/NciicServices", "nciicCombineSearch"));
// AND I MYSELF INCLUDE THESE LINES:
_call.setUsername("myUserName");
_call.setPassword("myPassword");
setRequestHeaders(_call);
setAttachments(_call);
But when I call the web service in this line:
java.lang.Object _resp = _call.invoke(new java.lang.Object[] {inParameter1, inParameter2});
The following error is thrown:
log4j:WARN See Apache log4j 1.2 - Frequently Asked Technical Questions for more info.
Exception in thread "Main Thread" AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl )
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl )
at javax.net.ssl.DefaultSSLSocketFactory.throwExcepti on(SSLSocketFactory.java:179)
.
.
.
Caused by: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl )
at java.security.Provider$Service.newInstance(Provide r.java:1245)
at sun.security.jca.GetInstance.getInstance(GetInstan ce.java:220)
at sun.security.jca.GetInstance.getInstance(GetInstan ce.java:147)
.
.
.
Caused by: java.security.KeyStoreException: PKCS7 not found
at java.security.KeyStore.getInstance(KeyStore.java:5 87)
at com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl .getDefaultKeyManager(DefaultSSLContextImpl.java:1 43)
.
.
.
Caused by: java.security.NoSuchAlgorithmException: PKCS7 KeyStore not available
at sun.security.jca.GetInstance.getInstance(GetInstan ce.java:142)
at java.security.Security.getImpl(Security.java:659)
at java.security.KeyStore.getInstance(KeyStore.java:5 84)
... 31 more
{http://xml.apache.org/axis/}hostname:WGC1062C9D9S1
If anyone have an idea about the solution, please help me. I donīt have the SSL private key, only the public key (the site where are the web service isnīt mine).
thanks in advance,
Sergio Stateri Jr.
sergio.stateri@globo.com