Hello,
 
I have installed the Axis 1.1 RC1 release, and I have still the same problem, about SSL and Axis.
Here is the sample that I am using :
 
import java.security.Security;
import javax.xml.namespace.QName;
import javax.xml.rpc.Call;
import org.apache.axis.client.Service;
import org.apache.axis.client.Stub;
import org.apache.axis.client.ServiceFactory;
import javax.net.ssl.SSLSocketFactory;
import java.net.URL;
import my_hello_world.MyHelloWorld;
import java.io.InputStreamReader;
 
public class BasicClient {
 
    public static void main (String[] args) {
        try {
            String urlBase = args[0];
            String uri = "MyHelloWorld?wsdl";
            System.setProperty (
"javax.net.ssl.trustStore","C:\\client.keystore");
            System.setProperty("javax.net.ssl.trustStorePassword","changeit");
            System.setProperty ("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");
            Security.addProvider (new com.sun.net.ssl.internal.ssl.Provider());
               
            { // this test works on http and https
                System.out.println("Trying to read the url: " + urlBase + "/" + uri);
                URL url = "" URL(urlBase + "/" + uri);
                InputStreamReader isr = new InputStreamReader(url.openStream());
                char[] buf = new char[1024];
                int nread;
                while ((nread = isr.read(buf, 0, buf.length)) > 0) {
                    System.out.print(new String(buf, 0, nread));
                }
                System.out.flush();
            }
      
            { // this test works only on http, but not on https
                String endpoint = urlBase + "/" + uri;
                String nsURI = "urn:my_hello_world";
                String port = "MyHelloWorld";
                String serviceName = "MyHelloWorldService";
                System.out.println ("endpoint : '" + endpoint + "'");
                URL url = "" URL(endpoint);
                ServiceFactory factory = (org.apache.axis.client.ServiceFactory) ServiceFactory.newInstance ();
                Service service = (org.apache.axis.client.Service) factory.createService (url,new QName (nsURI,serviceName));
                MyHelloWorld ref = (MyHelloWorld) service.getPort (new QName (nsURI,port),MyHelloWorld.class);
                System.out.println ("no error at this stage");
                System.out.println ("coucou sent; receiving : " + ref.getHelloMessage ("coucou"));
                System.out.println ("never reached when using ssl");
            } 
        }
        catch (Throwable t) {
            t.printStackTrace ();
        }
    }
}
 
This test contains two parts : a retrieval of my web service wsdl content, and a call to it.
When I am running it on http, it works fine : the wsdl is retrieved successfully, and my service is well invoked. But, when I am using ssl, the wsdl is retrieved sucessfully, according to the certificates set on the client and tomcat, but the call to my service fails, with the AxisFault on a NullPointerException, as described on my previous mail. The exception occurs on the call only, the creation of the stub is successful.
 
On the other hand, I have got a C++ client, which invokes successfully the service, so, I think that the problem comes from my client part.
 
Is there any known issue on that point, in Axis ?
Many thanks !!
 
Stephane.
-----Original Message-----
From: Stephane Lecercle [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 19, 2003 1:26 PM
To: '[EMAIL PROTECTED]'
Subject: Axis and SSL issue : NullPointerException on HTTPSender.getSocket

Hello,
 
I am trying to make a client invoke a web service with Axis/Tomcat.
The client initializes the JSSE with the following settings :
 
System.setProperty("javax.net.ssl.trustStore",_storeLocation);
System.setProperty("javax.net.ssl.trustStorePassword",_storePassword);
System.setProperty ("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");
Security.addProvider (new com.sun.net.ssl.internal.ssl.Provider());
 
When I am creating the service, everything seems ok : the handshaking is done successfully, and the stub to my service is created.
But, each time I am trying to invoke the web service, I get the following error :
 
AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: java.lang.NullPointerException
 faultActor: null
 faultNode: null
 faultDetail:
        stackTrace: java.lang.NullPointerException
        at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:157)
        at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:114)
        at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:156)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:126)
        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:182)
        at org.apache.axis.client.Call.invokeEngine(Call.java:2376)
        at org.apache.axis.client.Call.invoke(Call.java:2365)
        at org.apache.axis.client.Call.invoke(Call.java:2062)
        at org.apache.axis.client.Call.invoke(Call.java:1986)
        at org.apache.axis.client.Call.invoke(Call.java:1509)
        at my_hello_world.MyHelloWorldSoapBindingStub.getHelloMessage(G:/cc_views/common_as_kernel_rtm/wstk/samples/server_java/my_hello_world/MyHelloWorldSoapBindingStub.java:238)
 
        at com.bo.wstk.test.MyHelloWorldClient.main(G:/cc_views/common_as_kernel_rtm/wstk/samples/client_java/src/com/bo/wstk/test/MyHelloWorldClient.java:91)
 
The same client code, without any SSL stuff works fine : the creation and the use of the service is ok.
 
I have checked my runtime environment, everything seems ok. The certificates registered in the server.keystore and client.keystore are ok, according to the fact that the connection is done successfully during the stub creation. Do I miis something in the initialization ? (SSLSocketFactory/SSLSocket provider settings, ...) Is there something to do in the Axis configuration ?
Is there anybody to help me ?
Many thanks,
 
Stephane.

Reply via email to