通过 jax-ws Metro 使用 Exchange Web Service 2010 时出现问题
我正在尝试使用 JAX-WS 使用 Exchange 2010 Web 服务界面。我正在使用 JAX-WS 2.2 RI (Metro 2.0)。 2.1也出现了同样的问题。
我在使用 Exchange 时遇到了麻烦,它返回“HTTP/1.1 415 无法处理消息,因为内容类型 'text/xml;charset=utf-8' 不是预期的类型 'text/xml;charset=utf-8' ”。作为响应(2.1 引用了字符集值,否则相同的响应)。
显然,我需要指定确切的内容类型标头,以使 Exchange 满意。
有没有办法让我在不强迫我手动重建依赖项的情况下做到这一点?我目前依赖于已发布的 Maven 工件,并且如果可能的话,希望继续这样做。
使用进程是一个常规的 J2SE 应用程序,看不到任何容器。我可以控制应用程序,并且可以添加应用程序范围所需的几乎所有内容,但无法添加代理服务器等进程外项目。客户端类是从本地 WSDL 生成的,但字符集规范是从 jaxws RI 实现中声明的常量派生的,而不是生成的代码。因此,生成的 HTTP 传输由 Sun JRE5 或 JRE6 中的标准 http/https 客户端处理。
I am trying to consume the Exchange 2010 Web Service interface using JAX-WS. I'm using JAX-WS 2.2 RI (Metro 2.0). 2.1 exhibited the same problem.
I am running into trouble with Exchange, which returns "HTTP/1.1 415 Cannot process the message because the content type 'text/xml;charset=utf-8' was not the expected type 'text/xml; charset=utf-8'." as a reponse (2.1 quoted the charset value, otherwise same response).
Apparently I need to dictate the exact Content-type header for Exchange to be happy.
Is there a way for me to do this without forcing me to manually rebuild the dependency? I currently rely on published maven artifacts, and would like to continue doing this if at all possible.
The consuming process is a regular J2SE app, with no containers in sight. I have control of the application and can add pretty much anything required to the applications scope, but can not add out-of-process items like proxy servers. The client classes were generated from local WSDL, but the charset specification is derived from constants declared in the jaxws RI implementation, not the generated code. The resulting HTTP transport is thus handled by the standard http/https client from Sun JRE5 or JRE6.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自 此帖子(给出缓存链接,因为目前java.net论坛已关闭),看来是故障最终,您的 Exchange Web Service 2010 要求分号后有一个空格 - 这不是 w3c 规范的一部分。
解决方案可能是在 Metro 前面放置一些东西(取决于您的设置)以更改标题。
您可以尝试以下一些方法:
javax.xml.ws.etc
(或com.sun.etc..
在您的源代码中,然后复制粘贴该类的源代码,更改常量。From this thread (giving a cached link, because currently java.net forums are down), it appears that the fault is ultimately that your Exchange Web Service 2010 demands a space after the semicolon - something NOT part of the w3c spec.
A solution might be to put something (depending on your setup) in front of the metro to change the header.
You could try some of the following approaches:
javax.xml.ws.etc
(orcom.sun.etc..
in your sources, and copy-paste the source for that class, changing the constant.