Java Web服务无法从客户端连接(代理问题)

时间:2019-06-12 07:51:54

标签: java exception proxy jax-ws

我有写过Web服务的问题。现在,我想尝试使用“客户端类”。但是每次我尝试连接时,都会收到此异常:

Exception in thread "main" com.sun.xml.internal.ws.client.ClientTransportException: HTTP-Transportfehler: java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 403 Forbidden"
    at com.sun.xml.internal.ws.transport.http.client.HttpClientTransport.getOutput(HttpClientTransport.java:117)
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:208)
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:130)
    at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:95)
    at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:1121)
    at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:1035)
    at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:1004)
    at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:862)
    at com.sun.xml.internal.ws.client.Stub.process(Stub.java:448)
    at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:178)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:93)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:77)
    at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:147)
    at com.sun.proxy.$Proxy34.getVersion(Unknown Source)
    at asclienttest.ASClientTest.main(ASClientTest.java:120)
Caused by: java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 403 Forbidden"
    at sun.net.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnection.java:2142)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:183)
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1334)
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1309)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:259)
    at com.sun.xml.internal.ws.transport.http.client.HttpClientTransport.getOutput(HttpClientTransport.java:104)
    ... 14 more
C:\xxx\xxx\ASClientTest\nbproject\build-impl.xml:1040: The following error occurred while executing this line:
C:\xxx\xxx\ASClientTest\nbproject\build-impl.xml:805: Java returned: 1
BUILD FAILED (total time: 1 second)

我将使用具有有效wildcart ssl证书的普通域(development.domain.tld)。该域在我的hosts-file中路由到127.0.0.1,服务器和客户端存储在同一mashine中。在Windows的Internet选项中,我将在“例外站点”列表中定义一个条目,并可以通过浏览器和Netbeans获取wsdl。

我在客户端中使用此编码:

System.setProperty("java.net.useSystemProxies", "true");
System.setProperty("jdk.http.auth.tunneling.disabledSchemes", "");

ASEKVServiceImplService ws = new ASEKVServiceImplService(new URL("https://development.domain.tld:8080/webservice"));
ASEKVServiceImpl port = ws.getASEKVServiceImplPort();
String test = port.getVersion();

我将在最后一行获得异常。有谁知道我如何配置Java,他不尝试连接到该项目中的代理服务器?

非常感谢。

0 个答案:

没有答案