sushl created AXIS2-5610:
----------------------------

             Summary: SSL Connection fail through Proxy server(mod_proxy) using 
java(Axis2)
                 Key: AXIS2-5610
                 URL: https://issues.apache.org/jira/browse/AXIS2-5610
             Project: Axis2
          Issue Type: Bug
          Components: client-api, wsdl
    Affects Versions: 1.6.1
         Environment: OS:Windows 7
IDE: Eclipse
WebService: C#
Client Application:  java
            Reporter: sushl


I am using Java(Axis2) to connect .net web service. created stub class from 
WSDL2Java Converter. 
Proxy Server : Apache mod_proxy

Try to access code from C# and Java
below all cases are working with the C#, but getting error with the Java(Axis2)
(SSL = true, Proxy = false  : Success)
(SSl = false, Proxy = true : Success)
(SSL = true, Proxy = true : Fail (class javax.net.ssl.SSLException))

code:
ServiceStub objStub = new ServiceStub(sWebServiceURL);

//Setting Chunk http data to false and Cookie ID
                        
objStub._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
 Boolean.FALSE);
                        
objStub._getServiceClient().getOptions().setProperty("customCookieID",DEF_COOKIEID);
                        
objStub._getServiceClient().getOptions().setManageSession(true);

// In case of Proxy setting (HttpTransportProperties.ProxyProperties)
objStub._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.PROXY,
 objProxyProperties);

objStub._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE,
 objAuthenticator);

// to work without certifcate 
objProtocol = new Protocol("https", new NaiveSocketFactory(), 443);
                                        
objStub._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_PROTOCOL_HANDLER,
 objProtocol);

// inside NaiveSocketFactory I am using follwoing function
public Socket createSocket(final String host,
                                                           final int port,
                                                           final InetAddress 
localAddress,
                                                           final int localPort,
                                                           final 
HttpConnectionParams params) throws IOException, UnknownHostException, 
ConnectTimeoutException 
        {
                if (params == null) 
                {
                        throw new IllegalArgumentException("Parameters may not 
be null");
                }
                int timeout = params.getConnectionTimeout();
                SocketFactory socketfactory = 
getSSLContext().getSocketFactory();
                if (timeout == 0) 
                {
                        return socketfactory.createSocket(host, port, 
localAddress, localPort);
                }
                else 
                {
                        Socket socket = socketfactory.createSocket();
                        SocketAddress localaddr = new 
InetSocketAddress(localAddress, localPort);
                        SocketAddress remoteaddr = new InetSocketAddress(host, 
port);
                        socket.bind(localaddr);
                        socket.connect(remoteaddr, timeout);
                        return socket;
                }
        }

private static SSLContext createEasySSLContext() 
        {
                try 
                {
                        SSLContext context = SSLContext.getInstance("SSL");
                        context.init(null, new TrustManager[] {new 
NaiveTrustManager()}, null);
                        return context;
                }
                catch (Exception e) 
                {
                        LOG.error(e.getMessage(), e);
                        throw new HttpClientError(e.toString());
                }
        }


Exception Message: Unrecognized SSL message, plaintext connection? Stack Trace: 
org.apache.axis2.AxisFault: Unrecognized SSL message, plaintext connection?

Apache access.log
10.128.43.60 - - [24/Sep/2013:13:49:02 +0900] "\x16\x03\x01" 501 215






 



--
This message was sent by Atlassian JIRA
(v6.1#6144)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to