【发布时间】:2011-08-22 05:42:47
【问题描述】:
我们有 WAS(Websphere Application Server)7 Web 服务,它是对另一方 SSL 安全 WebService 的某种代理。
当在 WAS 外部使用我们的 WebService(客户端)时(例如使用 eclipse),它会毫无问题地连接,但在 WAS 内部则不会。我还创建了测试服务,它使用功能来打印对方 WebService (Server) wsdl。
public void testSSL() {
URL u;
InputStream is = null;
DataInputStream dis;
String s;
try {
System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
System.setProperty("javax.net.ssl.keyStore", "/home/..."); //path to jks certificate
System.setProperty("javax.net.ssl.keyStorePassword", "******");
System.setProperty("javax.net.ssl.requireClientAuth", "true");
u = new URL("https://...?WSDL");
is = u.openStream(); // throws an IOException
dis = new DataInputStream(new BufferedInputStream(is));
while ((s = dis.readLine()) != null) {
System.out.println(s);
}
} catch (MalformedURLException mue) {
System.out.println("Ouch - a MalformedURLException happened.");
mue.printStackTrace();
System.exit(1);
} catch (IOException ioe) {
System.out.println("Oops- an IOException happened.");
ioe.printStackTrace();
System.exit(1);
} finally {
try {
is.close();
} catch (IOException ioe) {
// just going to ignore this one
}
} // end of 'finally' clause
}
【问题讨论】:
-
它会抛出哪个异常?
-
是的,请发布异常跟踪。