I am using Mule 3.4.0 and am making a flow that calls some RESTful API endpoints on a JIRA server using an HTTPS outbound endpoint. I am having a problem because Mule is for some reason sending a Content-Type header value that causes an exception in JIRA. It looks like, judging from the JIRA stack trace, that Mule is sending this:
application/json, application/json;charset=UTF-8
JIRA is using Jersey and Jersey is unable to parse that Content-Type value. Here is a portion of the stack trace returned by JIRA:
Caused by: java.lang.IllegalArgumentException: Error parsing media type 'application/json, application/json;charset=UTF-8' at com.sun.jersey.core.impl.provider.header.MediaTypeProvider.fromString(MediaTypeProvider.java:79) at com.sun.jersey.core.impl.provider.header.MediaTypeProvider.fromString(MediaTypeProvider.java:53) at javax.ws.rs.core.MediaType.valueOf(MediaType.java:119) at com.sun.jersey.server.impl.model.HttpHelper.getContentType(HttpHelper.java:89) ... 157 more Caused by: java.text.ParseException: Expected separator ';' instead of ',' at com.sun.jersey.core.header.reader.HttpHeaderReader.nextSeparator(HttpHeaderReader.java:117) at com.sun.jersey.core.header.reader.HttpHeaderReader.readParameters(HttpHeaderReader.java:239) at com.sun.jersey.core.impl.provider.header.MediaTypeProvider.valueOf(MediaTypeProvider.java:97) at com.sun.jersey.core.impl.provider.header.MediaTypeProvider.fromString(MediaTypeProvider.java:77)
I would like to be able to force a specific Content-Type value to be sent, but I can't figure out how to do that. It seems like Mule automatically builds the Content-Type value based on a combination of factors:
http://www.mulesoft.org/documentation/display/current/HTTP+Transport+Reference
If the endpoint has encoding set explicitly, use that Otherwise, take it from the message's property Content-Type If none of these is set, use the Mule Context's configuration default. For Content-Type, send the message's property Content-Type but with the actual encoding set.
So I think it's using the inbound property Content-Type, but since that's an inbound property I don't think I can modify/delete that in the flow. My attempts to modify/delete the Content-Type property have been ineffective. I can only modify/delete the outbound Content-Type property, which doesn't seem to help with my outbound HTTP request.
Any info on how to control the Content-Type value or fix it or something would be appreciated.