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 "Robert Lazarski (Jira)" <ji...@apache.org> on 2024/10/26 12:08:00 UTC
[jira] [Commented] (AXIS2-5610) SSL Connection fail through Proxy server(mod_proxy) using java(Axis2)
[ https://issues.apache.org/jira/browse/AXIS2-5610?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17893061#comment-17893061 ]
Robert Lazarski commented on AXIS2-5610:
----------------------------------------
SSLContext.getInstance("SSL") should be SSLContext.getInstance("TLSv1.3") .
That code is still insufficient if you are using self-signed certs.
Axis2 definitely works fine with SSL as I use it exclusively at my day job, so I am going to close this issue however if you still have problems I may be able to help.
> 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
> Priority: Major
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> 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
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org