Best unofficial Apache Server developers community
Username
Forgot password?
Sign in with Twitter account
Sign in with Facebook account

How to submit JSON data as request body in Apache CXF jax-rs (REST)

0

83 views

I am using Apache-CXF for creating REST web services and trying to submit a form.

Server: This is my method, which is expected to get json data.

@POST @Path("/addCustomer/") @Consumes(MediaType.APPLICATION_JSON) //{"Customer":{"name":"Some Name","id":6}} public Customer addCustomer(Customer customer){ logger.debug(customer); return customer; }

Client: I am using firefox REST plugin for submitting request: Using REST client, I have posted following json as request body: {"Customer":{"name":"Arnav Awasthi","id":6}}

But I am getting "415: Unsupported Media Type".

asked April 30, 2011 3:22 pm CDT
posted via StackOverflow

1 Answers

1
 

You have to find a way to tell firefox to set the content-type to application/json. The error indicates that it's sending something else.

answered May 1, 2011 6:38 am CDT

Your answer

Join with account you already have


Sign in with Twitter account
Sign in with Facebook account
Sign in with Google Friend Connect

Preview
Similar questions