[英]ClientTransportException: The server sent HTTP status code 302: Found
I am testing a webservice and it works fine in SOAP UI tool. 我正在测试一个Web服务,它在SOAP UI工具中可以正常工作。 Now I am writing a webservice client in java to test same. 现在,我正在用Java编写一个Web服务客户端以对其进行测试。 I executed the wsimport command and generated the required classes. 我执行了wsimport命令并生成了所需的类。 The issue is when I am calling the service it displays the following message in console. 问题是当我调用服务时,它在控制台中显示以下消息。 It seems the server is trying to redirect but redirection is failing. 似乎服务器正在尝试重定向,但重定向失败。 I am doubting there may be issue with http/https OR GET/POST methods but not sure how to fix. 我怀疑http / https或GET / POST方法可能存在问题,但不确定如何解决。
Exception in thread "main" com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 302: Found
at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.checkStatusCode(Unknown Source)
at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.createResponsePacket(Unknown Source)
at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(Unknown Source)
at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(Unknown Source)
at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(Unknown Source)
at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Unknown Source)
at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Unknown Source)
at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Unknown Source)
at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Unknown Source)
at com.sun.xml.internal.ws.client.Stub.process(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(Unknown Source)
Please suggest. 请提出建议。
Regards, Arun 问候,阿伦
After more analysis and change I am able to fix this issue. 经过更多分析和更改,我能够解决此问题。 As I doubted the cause was redirection from http to https. 我怀疑原因是从http重定向到https。 This post helped: Calling web service that sits on a load balancer with jax-ws returns at http status of 302, but when I use SoapUI it works fine 这篇文章有帮助: 调用带有jax-ws的负载平衡器上的Web服务,返回的HTTP状态为302,但是当我使用SoapUI时,它工作正常
Regards, Arun 问候,阿伦
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.