Looking through the code, it seems that if the body is null (which has
to be the case considering it's a get, then the content type is
overwritten with wildcards.
Using client.invoke("GET",""); solved the problem for me.Jeff -----Original Message----- From: Jeff Wang [mailto:[email protected]] Sent: Wednesday, July 27, 2011 5:29 PM To: [email protected] Subject: WebClient - Content-Type Override? I'm trying to act as a proxy to a third party webservice, and need to transform a REST request. One issue that I have is that the Content-Type header seems to get overridden no matter what I do. The code is actually very simple (context is an @Context MessageContext variable): WebClient client = WebClient.create(url) .header("real-header-removed", "auth-string-removed") // .header("Content-Type", context.getHttpHeaders().getMediaType().toString()); .type(context.getHttpHeaders().getMediaType()); Response resp = client.get(); return (InputStream)resp.getEntity(); Neither the .header nor the .type worked. The tcpmon output of the request is: Content-Type: */* real-header-removed: auth-string-removed Accept: application/xml User-Agent: Apache CXF 2.3.5 Cache-Control: no-cache Pragma: no-cache How do I avoid the content Type override (or rather, why is it happening?) Btw, while looking for answers, I found my CXF server side answers relatively easily either via google or the archive. But client questions seems to be rather rare, and mostly on the SOAP calls. Are most people using other packages? thanks Jeff
