Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Not A Problem
-
1.6.1
-
None
-
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)
int timeout = params.getConnectionTimeout();
SocketFactory socketfactory = getSSLContext().getSocketFactory();
if (timeout == 0)
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[]
, null);
return context;
}
catch (Exception e)
}
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