使用jax-ws Metro消耗Exchange Web Service 2010的问题 [英] Problem consuming Exchange Web Service 2010 with jax-ws metro

查看:92
本文介绍了使用jax-ws Metro消耗Exchange Web Service 2010的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用JAX-WS使用Exchange 2010 Web服务接口.我正在使用JAX-WS 2.2 RI(Metro 2.0). 2.1出现了相同的问题.

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.

我在使用Exchange时遇到麻烦,它返回"HTTP/1.1 415无法处理消息,因为内容类型'text/xml; charset = utf-8'不是预期的类型'text/xml; charset = utf -8'."作为响应(2.1引用了字符集值,否则为相同的响应).

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).

显然,我需要指定确切的Content-type标头才能使Exchange满意.

Apparently I need to dictate the exact Content-type header for Exchange to be happy.

有没有一种方法可以使我不必强迫我手动重建依赖关系?我目前依靠发布的Maven工件,并尽可能地继续这样做.

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.

消费过程是一个常规的J2SE应用程序,看不到任何容器.我可以控制应用程序,并且可以将几乎所有需要的内容添加到应用程序范围中,但是不能添加诸如代理服务器之类的进程外项目.客户端类是从本地WSDL生成的,但是字符集规范是从jaxws RI实现中声明的常量而不是生成的代码派生的.因此,最终的HTTP传输由Sun JRE5或JRE6的标准http/https客户端处理.

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.

推荐答案

来自

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:

  • 使用反射更改Metro常数.
  • 使用AOP(我无法告诉您精确程度如何)
  • 查看此常量在Metro中的定义位置,在源中创建一个包javax.xml.ws.etc(或com.sun.etc..),然后复制粘贴该类的源,更改该常量.
  • Use reflection to change the Metro constant.
  • Use AOP (I can't tell you how exactly)
  • See where is this constant defined in Metro, create a package javax.xml.ws.etc (or com.sun.etc.. in your sources, and copy-paste the source for that class, changing the constant.

这篇关于使用jax-ws Metro消耗Exchange Web Service 2010的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆