The curl command you are using sends data the same way a form post does in
HTML, so the media type you want is:

@Consumes(MediaType.APPLICATION_FORM_URLENCODED)

Craig



On Tue, May 27, 2014 at 2:12 AM, Adrián Roselló Rey <
[email protected]> wrote:

> Hi all!
>
> I'm using JAXRSClientFactoryBean to create REST clients for my application.
> I'm building the interface that will be used as resource class for
> JAXRSClientFactoryBean to provide the client.
>
> The server always produces and consumes "application/xml"  MediaType, so
> I'm adding following annotations to the methods:
>
>
>
> *@Produces(MediaType.APPLICATION_XML)@Consumes(MediaType.APPLICATION_XML) *
> *public ReturnType myMethod(ParameterType param1)*
>
>
> My data types are serialized and deserialized by JAXB perfectly.
>
> Now I have to send a POST method with the following structure:
>
> curl -v  -X POST "http://server/service.xml"; -d 'param1=1234&param2=24523'
>
>
> As you could see, the body of the message is no longer an XML, and its
> structure is like the query parameters one.
>
> My question is, is there annotation I can use in my method so its
> parameters are serialized in this format?
>
> Thanks a lot!
>
> All the best,
>
> Adrián Rosello Rey
>
>
>
> --
>
>
>
>
> * Adrián Roselló Rey Distributed Applications and Networks Area (DANA)
> i2CAT Foundation, Barcelona, Spain*
> T: +34 93 553 25 49
> http://dana.i2cat.net
>

Reply via email to