LuigiEdlCarno
LuigiEdlCarno

Reputation: 2415

Java Trusting ssl CA

I guess I am out of ideas here.

I am trying to consume a web service in java which has an ssl certificate.

I createt a a keystore file in which I have added the certificate. The file lies in my project folder.

I imported it using:

System.setProperty("javax.net.ssl.keyStore", "folder\\keystore.jks");
System.setProperty("javax.net.ssl.keyStorePassword", "SECRET");

Apparently, the web service call checks the keystore because when giving a wrong path to the file the application throws an exception when invoking the WS, not when setting the system property.

Anyway, when giving the correct path to the keystore file, I still get

AxisFault faultCode: {http://xml.apache.org/axis/}HTTP faultSubcode: faultString: (401)Authorization Required

Someone told me I had to trust the CA, before any of this would work.

How do I do this?

Upvotes: 0

Views: 276

Answers (1)

LuigiEdlCarno
LuigiEdlCarno

Reputation: 2415

I figured it out. Apparently the service uses HTTP Basic authentication.

The Stub that Axis generated (which extends org.apache.axis.client.stub), needs the following 2 lines in the constructor

((org.apache.axis.client.Stub) this)._setProperty(org.apache.axis.client.Call.USERNAME_PROPERTY, "HTTPUSER");
((org.apache.axis.client.Stub) this)._setProperty(org.apache.axis.client.Call.PASSWORD_PROPERTY, "HTTPPW");

Thank ya'll for ya help.

Regards

Upvotes: 1

Related Questions