Netbeans中生成的Java Web Service客户端-获取Http状态码307 [英] Java web service client generated in Netbeans - getting Http Status Code 307
问题描述
我使用Netbeans生成Web服务客户端代码,即客户端样式的JAX-WS,因此可以调用Web服务API.
I use Netbeans to generate web service client code, client-style JAX-WS, so i can invoke a web service API.
但是,当我调用Web服务API时,出现异常: com.sun.xml.internal.ws.client.ClientTransportException:服务器发送了HTTP状态码307:临时重定向
However, when I invoke the web service API, I get the exception: com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 307: Temporary Redirect
我为什么要得到这个?解决方法是什么?我知道问题不在于Web服务本身,因为我可以通过soapUI和.Net很好地获得响应.
Why do I get this? What is the workaround? I know the problem isn't with the web service itself, because I can get responses fine via soapUI and .Net.
推荐答案
是的,我知道这篇文章很旧,但是我也遇到了类似的错误,并认为也许有人会从我的解决方案中受益.
最困扰我的是:
Yes I know this post is old, but I've had similar errors, and thought maybe somebody would benefit from my solution.
the one that plagued me the most was:
com.sun.xml.ws.client.ClientTransportException: The server sent HTTP status code 200: OK
事实证明这是不完整的响应标头.显然,jax-ws进行了某种验证,其中包括也验证HTTP标头.我正在使用的服务器只是发送一个空头.
Which turns out to mean an incomplete response header. Apparently jax-ws does some kind of validation that includes validating the HTTP headers as well. And the server I was using was just sending an empty header.
在 Content-Type
标头中添加 'application/soap+xml'
后,它像一种魅力一样工作.
It worked like a charm after adding 'application/soap+xml'
to the Content-Type
header.
这篇关于Netbeans中生成的Java Web Service客户端-获取Http状态码307的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!