Web服务客户端-由于超时而导致构造失败(代理问题) [英] Web Service Client - Construction Failing Due To Timeout (Proxy Issue)

查看:125
本文介绍了Web服务客户端-由于超时而导致构造失败(代理问题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Java 1.6中有一个扩展了javax.xml.ws.Service的Web服务. WSDL URL位于HTTPS端点,我在公司代理(我相信是NTLM)的后面.我有代理主机,端口,用户名和密码.如果已经在.curlrc文件中指定了代理,我已经验证可以使用curl访问WSDL.调用构造函数时,它将最终超时并显示以下错误:

I have a webservice in Java 1.6 that extends javax.xml.ws.Service. The WSDL URL is located at an HTTPS endpoint and I am behind a corporate proxy (NTLM I believe). I have the proxy host, port, username, and password. I have verified that I can access the WSDL using curl if I specify the proxy in my .curlrc file. When the constructor is called it will eventually timeout with the error:

javax.xml.ws.WebServiceException:在以下位置无法访问WSDL: https://www.blah.com/myservice.asmx?wsdl .它失败了: 连接超时.

javax.xml.ws.WebServiceException: Failed to access the WSDL at: https://www.blah.com/myservice.asmx?wsdl. It failed with: Connection timed out.

失败的呼叫是:

public MyService_Service() {
    // this call to super is the one that times out
    super(__getWsdlLocation(), MYSERVICE_QNAME);
}

我尝试了以下方法,但没有一种解决方法.

I have tried the following but none of the solutions work.

  • Client Webservice in java - proxy authentication
  • Java Web Service client basic authentication

我该怎么做才能从代理后面调用Web服务?

What can I do to call the web service from behind a proxy?

推荐答案

我能够通过在服务器实例化之前添加以下代码来使其工作:

I was able to get this to work by adding the following code before the server instantiation:

System.setProperty("proxyHost", "myproxy.com");
System.setProperty("proxyPort", "8080");

奇怪的是,当我通过设置VM选项-DproxyHost-DproxyPort进行测试时,此方法有效,然后搜索如何以编程方式对其进行设置.

Strangely this worked when I tested it by setting the VM options -DproxyHost and -DproxyPort so then searched for how to set it programmatically.

这篇关于Web服务客户端-由于超时而导致构造失败(代理问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆