gpt4 book ai didi

java - 客户端传输异常 : The server sent HTTP status code 302: Found

转载 作者:行者123 更新时间:2023-12-02 03:43:22 25 4
gpt4 key购买 nike

我正在测试一个 Web 服务,它在 SOAP UI 工具中运行良好。现在我正在用java编写一个web服务客户端来测试它。我执行了 wsimport 命令并生成了所需的类。问题是当我调用该服务时,它在控制台中显示以下消息。服务器似乎正在尝试重定向,但重定向失败。我怀疑 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)

请提出建议。

问候,阿伦

最佳答案

经过更多分析和更改,我能够解决此问题。我怀疑原因是从 http 重定向到 https。这篇文章有帮助: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

问候,阿伦

关于java - 客户端传输异常 : The server sent HTTP status code 302: Found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36585794/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com