TIBCO HTTP 415 Unsupported Media Type

Environment

TIBCO TRA 5.8

REST/JSON WebService

method: GET

Symptom

When calling a REST WebService by “Send HTTP Request” activity, an error “HTTP 415 unsupported media type” occurs.

Reason

The REST WebService does not agree with the media type specified on the request.

I did some experiments using jersey to create a REST WebService and added these annotations:

@GET
@Path(…)
@Produces(MediaType.APPLICATION_JSON)

TIBCO works find.

But if I used these annotations:

@GET
@Path(…)
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)

TIBCO will get the “HTTP 415” error.

Solution

Step 1. Confirm the content-type which the REST WebService supports.

Step 2. “Send HTTP Request” activity→Input→Headers→Content-Type: ‘application/json‘. Must set the “Content-Type” explicitly if the REST WebService specified the @Consumes annotation.

If the REST WebService does not specify @Consumes, no need to set the Content-Type of the “Send HTTP Request”.

@Consumes incompatible: HTTP 415 Unsupported Media Type

@Produces incompatible: HTTP 406 Not Acceptable

Reference

https://docs.oracle.com/cd/E19798-01/821-1841/gipzh/index.html

http://stackoverflow.com/questions/13246529/http-415-while-sending-json-object-using-post

http://100pulse.com/http-statuscode/415.jsp

http://www.ibm.com/support/knowledgecenter/SSHJB3_6.2.0/com.ibm.curam.content.doc/MSDK/tshoot_415_unsupported_media_type_response.html

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s