Problem consuming Exchange Web Service 2010 with jax-ws metro

Posted by Johan Karlberg on Stack Overflow See other posts from Stack Overflow or by Johan Karlberg
Published on 2009-12-16T10:51:01Z Indexed on 2010/05/16 2:00 UTC
Read the original article Hit count: 370

Filed under:
|
|
|

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.

© Stack Overflow or respective owner

Related posts about java

Related posts about jax-ws