Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-5610

SSL Connection fail through Proxy server(mod_proxy) using java(Axis2)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.6.1
    • None
    • client-api, wsdl
    • None
    • OS:Windows 7
      IDE: Eclipse
      WebService: C#
      Client Application: java

    Description

      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 MySocketFactory(), 443);
      objStub._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.CUSTOM_PROTOCOL_HANDLER, objProtocol);

      // inside MySocketFactory 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

      Attachments

        Activity

          People

            Unassigned Unassigned
            sushil.vichare511 sushl
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified