尝试从JAX-WS调用asmx https Web服务时连接超时

时间:2012-11-13 14:20:51

标签: ssl jax-ws webservice-client

我正在尝试调用其端点超出https的外部Web服务。

我们正在尝试使用JAX-WS(Java EE 6中的Oracle标准实现)进行调用。

在设置代理之后从SoapUI中它可以正常工作,但是从我们的代码中我们得到了这个堆栈跟踪:

[11/13/12 12:46:55:389 CET] 00000024 SystemErr R javax.xml.ws.WebServiceException: java.net.ConnectException: Connection timed out: no further information
[11/13/12 12:46:55:405 CET] 00000024 SystemErr R at org.apache.axis2.jaxws.ExceptionFactory.createWebServiceException(ExceptionFactory.java:175)
[11/13/12 12:46:55:405 CET] 00000024 SystemErr R at org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:70)
[11/13/12 12:46:55:405 CET] 00000024 SystemErr R at org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:128)
[11/13/12 12:46:55:405 CET] 00000024 SystemErr R at org.apache.axis2.jaxws.core.controller.impl.AxisInvocationController.execute(AxisInvocationController.java:586)
[11/13/12 12:46:55:405 CET] 00000024 SystemErr R at org.apache.axis2.jaxws.core.controller.impl.AxisInvocationController.doInvoke(AxisInvocationController.java:130)
[11/13/12 12:46:55:405 CET] 00000024 SystemErr R at org.apache.axis2.jaxws.core.controller.impl.InvocationControllerImpl.invoke(InvocationControllerImpl.java:93)
[11/13/12 12:46:55:405 CET] 00000024 SystemErr R at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invokeSEIMethod(JAXWSProxyHandler.java:364)
[11/13/12 12:46:55:405 CET] 00000024 SystemErr R at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invoke(JAXWSProxyHandler.java:185)

我们不知道为什么我们获得连接超时,因为从SoapUI一切正常......

以下是我们使用的代码:

ResultBlock rb = null;
Matching stub=new Matching();
MatchingSoap soapPort = stub.getMatchingSoap();
BindingProvider provider = (BindingProvider) soapPort;
Map<String, Object> context = provider.getRequestContext();
if(!"".equals("cvsa"))//Conf.getPROXY_URL()
{
    System.getProperties().get("http.proxyPort");
    //Authenticator.setDefault(new ProxyAuthenticator("user", "password")); 
    System.getProperties().put("proxySet", "true");
    System.setProperty("http.proxyHost", "proxy.xxxxx.xxxx.xx"); 
    System.setProperty("http.proxyPort", "3128"); 
}
context.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "https://xxx.xxx.xxx.xxx/OnlineMatchingCore/OnlineMatching.asmx" );
//context.put(JAXWSProperties.HTTP_CLIENT_STREAMING_CHUNK_SIZE, 8192);
System.out.println(provider.getEndpointReference().toString());
// Authenticator.setDefault(new ProxyAuthenticator("USER", "PASSWORD"));


// Security.setProperty("ssl.SocketFactory.provider", "com.ibm.jsse2.SSLSocketFactoryImpl");
// Security.setProperty("ssl.ServerSocketFactory.provider", "com.ibm.jsse2.SSLServerSocketFactoryImpl");

String result = soapPort.match(controlXml, batchXml, "USER", "PASSWORD");

我在互联网上看到很多关于这样的问题的线索,但我找不到任何解决方案:

我不知道该尝试什么,我的想法是我遗漏了一些关于告诉java webservice在https上的内容......

1 个答案:

答案 0 :(得分:0)

您是否尝试过设置https代理而不是http代理?

System.setProperty("https.proxyHost", "proxy ip");
System.setProperty("https.proxyPort", "port");