hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <sivasaibabu.parupa...@bt.com>
Subject Httpclient-webservice
Date Fri, 19 Dec 2008 14:57:45 GMT

HI I am trying to connect to webservice url from behind a firewall.
Since it is the secured site they gave necessary permissions to our fire
wall so now we can see the wsdl file from the browser.
They also sent one pfx certificate and password for it.
Now I am trying to connect to that webservice from our application
developed in Java using httpclient.
After creating necessary keystore and ssl connections it is throwing
unknown host exceptions.
We connect to many urls behind firewall with no problems. 

Please suggest us how to connect to webservice url
Is there any way to connect with out sockets?

Plz can some one help me to solve it

Here is some code snippet


try{
					
					int Port=443;
					System.out.println("socket block
1");
	
//char []passwKey = "VFPimport".toCharArray();
					
					
					
					char []passwKey =
"changeit".toCharArray();
	
KeyStore ts = KeyStore.getInstance("JKS");
	
ts.load(new FileInputStream(basePath +
CLIENT_KEYSTORE_PATH+"\\supplier_keystore"), passwKey);
	
//System.out.println((String)ts.toString());
	
KeyManagerFactory tmf = KeyManagerFactory.getInstance("SunX509");
	
tmf.init(ts,passwKey);
	
SSLContext sslContext = SSLContext.getInstance("TLS");
	
sslContext.init(tmf.getKeyManagers(), null, null);
	
SSLSocketFactory factory =sslContext.getSocketFactory();
	
HttpsURLConnection.setDefaultSSLSocketFactory(factory);
	
SSLSocket socket = (SSLSocket) factory.createSocket(supplierUrl,Port);
// Create the ServerSocket
	
String[] suites = socket.getSupportedCipherSuites();
	
socket.setEnabledCipherSuites(suites);
//
start handshake
	
socket.startHandshake();
					
				
					
				status =
checkClient.executeMethod(postMethod);
				
				


Regards

Sai














Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message