如何覆盖 .NET Web 服务的 Axis2 请求标头?
我必须使用在 .NET 2.0 中实现的第三方 Web 服务(当然是在 IIS 上)。
我必须做一个java客户端。 我正在使用 wsdl2java 生成 SOAP 存根。
由于原来的 Apache Axis 项目现在似乎不再维护,而且我在解析服务的一些响应时遇到了一些问题,因此我将客户端转换为使用最新 (1.5) 版本的 Axis2。 现在,.NET 服务甚至无法识别我的请求。
我设法关闭了“分块”(其中“存根”是由 wsdl2java 生成的 MumbleStub 类型的变量,我在这里将几行代码显示为一个可怕的行):
stub._getServiceClient().getOptions().setProperty( HTTPConstants.CHUNKED, Boolean.FALSE);
..所以至少该服务可以识别我的请求 AS 是一个请求,尽管是一个糟糕的请求:“HTTP/1.1 400 Bad Request
”现在是响应(而不是为我提供的“介绍/摘要”页面) WSDL 的链接)。
我注意到 Axis(“1”)请求具有不同的 Content-TYPE 标头(text/xml,与 application/soap-xml),我想知道如何更改此请求标头(如果这确实是问题)。
或者,还有其他人遇到过这个问题吗? 问题真的是(此处无法显示,因为它看起来像博客引擎的“元素注入”)... xml 版本-“1.0”... Axis2 添加到请求开头的“XML 元介绍标记”?
WS-死星,确实如此。
I have to use a 3rd party web service implemented in .NET 2.0 (on IIS, of course).
I have to make a java client. I am using wsdl2java to generate the SOAP stub.
As the original Apache Axis project now appears unmaintained, and I was having some problems parsing some responses from the service, I converted the client to use the latest (1.5) version of Axis2. Now, the .NET service won't even recognize my requests.
I managed to get the "chunking" turned off (where "stub" is a variable of type MumbleStub generated by wsdl2java, and I am showing what are several lines of code as one horrific line here):
stub._getServiceClient().getOptions().setProperty( HTTPConstants.CHUNKED, Boolean.FALSE);
.. so at least the service recognizes my request AS a request, albeit a bad one: "HTTP/1.1 400 Bad Request
" is the response now (as opposed to an "intro / summary" page offering me a link to the WSDL).
I noticed that the Axis ("1") request had a different Content-TYpe header (text/xml, vs application/soap-xml), and I am wondering how to change this request header, if that is in fact the problem.
Alternately, has anybody else had this problem? Is the problem really the (undisplayable here, as it looks like "element injection" to the blog engine) ... xml version-"1.0" ... "XML meta intro tag" that Axis2 added to the beginning of the request?
WS-Deathstar, indeed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您提到不同的内容类型标头时,我猜您的客户端尝试发送 SOAP 1.2 请求,而第 3 方应用程序仅理解 SOAP 1.1
尝试更改使用的肥皂版本,因为 AFAIK AXIS2 默认情况下使用 SOAP 1.2
As you mention the different content-type header I guess your client tries to send SOAP 1.2 requests and the 3rd party app only understands SOAP 1.1
Try changing the used soap version as AFAIK AXIS2 uses SOAP 1.2 by default