You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Aegis1888 <ja...@cdms.co.uk> on 2008/10/20 18:36:55 UTC

HTTPS Client With AXIS2

Hi Guys,

I have a axis web service that I want to access via a java client. Now I
have managed to successfully connect to it via  http, however I am having
some trouble connection with https. In addition I am able to view the
service wsdl with my browser using https. I am using tomcat 5.5 and axis2.
Authentication has been deactivated in the tomcat config. I tried to create
a client like so;

public static void main(String[] args) {
		try{
			 		   
            Hello_ServiceStub stub =
                new
Hello_ServiceStub("https://localhost:8443/axis2/services/Hello_Service");
            
            SayHelloDocument doc = SayHelloDocument.Factory.newInstance();
            SayHello say = doc.addNewSayHello();

            say.setFirstName("Jay");
            
            SayHelloResponseDocument resp = stub.sayHello(doc);
            	
            System.out.println(resp.getSayHelloResponse().getGreeting());

        } catch(Exception e){
            e.printStackTrace();
            System.err.println("\n\n\n");
        }
	} 

However I get the following error;

org.apache.axis2.AxisFault: sun.security.validator.ValidatorException: PKIX
path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find
valid certification path to requested target
	at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
	at
org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:83)
	at
org.apache.axis2.transport.http.AxisRequestEntity.writeRequest(AxisRequestEntity.java:84)
	at
org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:499)
	at
org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2114)
	at
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096)
	.....

So i changed the code to include some properties like so;

System.setProperty("java.protocol.handler.pkgs",
		        "com.sun.net.ssl.internal.www.protocol");
		   Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());


but that did absolutely nothing! The certificate I created on the server is
self-signed. Can anyone give me an example on how to generate a client to
access https content from a server that does not require authentication?
-- 
View this message in context: http://www.nabble.com/HTTPS-Client-With-AXIS2-tp20073698p20073698.html
Sent from the Axis - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org