Posts

Showing posts from July, 2014

How to enforce a default HTTP Content-Type for requests in WSO2 ESB

Occasionally, you will get requests from legacy client applications that do not include HTTP Content-Type header. WSO2 ESB proceeds with the mediation flow only after building the relevant SOAP infoset using the message builders registered against the Content-Type of the incoming request. In case the Content-Type is blank, you will experience an error similar to the following in the log. ERROR - RelayUtils Error while building Passthrough stream java.lang.StringIndexOutOfBoundsException: String index out of range: -1  If modification of client applications to include the mandatory Content-Type HTTP header in POST requests is out of your control, we should be able to set a default content type for such incoming requests. In WSO2 ESB, you can use the following property to set a default Content-Type for the incoming requests in case the HTTP request does not have Content-Type header. i.e:- <parameter name="DEFAULT_REQUEST_CONTENT_TYPE" locked="false&