You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Johnson, Michael1 [IT]" <mi...@citigroup.com> on 2002/08/29 14:09:01 UTC

web service client over ssl

Hi all ive been having problems getting this client to work over ssl. I keep
getting an error java.net.SocketException: SSL implementation not available.
Here is the source for my client. My c:\jdk1.3\bin\client.keystore exists
but is null. I was exception this to return untrusted certificate. Thanks in
advance for any help.

-MJ



import org.apache.axis.client.Call;
import org.apache.axis.client.Service;

import java.rmi.RemoteException;
import java.net.MalformedURLException;
//import javax.xml.rpc.namespace.QName;
import javax.xml.rpc.ServiceException;

import javax.xml.namespace.QName;
import javax.net.ssl.SSLSocketFactory;
import java.security.Security;
import javax.security.*;
import java.net.*;

public class TestClient {
	public static void main(String [] args) {
       try {

           // specify the location of where to find key material for the
default TrustManager (this overrides jssecacerts and cacerts)
 
System.setProperty("javax.net.ssl.trustStore","C:\\jdk1.3\\bin\\client.keyst
ore");
           // use Sun's reference implementation of a URL handler for the
"https" URL protocol type. 
 
System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.ww
w.protocol");       
      	   // dynamically register sun's ssl provider
           Security.addProvider(new
com.sun.net.ssl.internal.ssl.Provider());      	
           
        

           
           String endpoint =
"https://127.0.0.1/service-bin/testapp/servlets/AxisServlet/";
		   String outstr = "Test output";
		   Service  service = new Service();
           Call     call    = (Call) service.createCall();
		   call.setUsername("CCGdemo1");
		   call.setPassword("Parsley");
           call.setTargetEndpointAddress( new java.net.URL(endpoint) );
           call.setMaintainSession (true);
           call.setOperationName(new QName("BAWSRequest",
"generalInquiry"));
           

           QName p0QName = new javax.xml.namespace.QName("", "in0");
           call.addParameter(p0QName, new
QName("http://schemas.xmlsoap.org/soap/encoding/", "string"),
java.lang.String.class, javax.xml.rpc.ParameterMode.IN);
           
           call.setReturnType(org.apache.axis.Constants.XSD_STRING);

           String ret = (String) call.invoke( new Object[] { outstr } );

           System.out.println(".... back from server\n" + ret);
       } catch (Exception e) {
       		e.printStackTrace();
           System.err.println(e.toString());
       } 
   }
}