Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Unsupported Media Exception  RSS feed

 
Mike London
Ranch Hand
Posts: 1476
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

My service has code like the code below, which works fine testing the POST from the Intellij Rest test environment.

The XML Request comes in as a String.

@POST
@Consumes("application/xml")
public StreamingOutput createCustomer(InputStream is) throws IOException
{
Customer customer = readCustomer(is);
customer.setId(idCounter.incrementAndGet());
customerDB.put(customer.getId(), customer);

StreamingOutput custValue = getCustomer(1);

return custValue;
}

The output, in Intellij, after the POST, in Intellij's REST Explorer, is:

<customer id="1">
<first-name>Bill</first-name>
<last-name>Burke</last-name>
<street>256 Clarendon Street</street>
<city>Boston</city>
<state>MA</state>
<zip>02115</zip>
<country>USA</country>
</customer>

Hurray, but ....

----

YET, if I do the exact same Request and same URL in Firefox's "RESTCLIENT", I get:

Status Code: 415 Unsupported Media Type
Content-Length: 0
Date: Wed, 26 Feb 2014 16:45:25 GMT
Server: Apache-Coyote/1.1

What gives?

Do I need to return a particular type for the RESTCLIENT in FireFox to read the response or am I missing something else?

Thanks in advance,
mike


 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!