You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by David Corral Sanz <da...@lineadirecta.es> on 2011/02/10 16:00:50 UTC

Posting several beans using JSON to a REST service

We have tried several approaches to invoke services that have a signature 
like:

public void (BeanA, BeanB)

but none have worked. So much so that we are really consiering if the 
feature is not implemented.

Here's some sample pseudo-code of what we need:

$.ajax({
   type: "POST",
   url: '...',
   contentType: "application/json",
   data: {"beanA":{}, "beanB":{}},
   dataType: 'application/json',
});

<resource name="..." path="foo"> 
    <operation name="bar" verb="POST" path="/baz">
        <param name="xxx" type="REQUEST_BODY"/>
        <param name="yyyy" type="REQUEST_BODY"/>
    </operation> 
</resource>

We've tried Jettison and Jackson providers (and no annotations anywhere). 
We were not able to send sucessufully more than one bean in a request. Any 
help? Thanks in advance

Vis�tenos en:  www.lineadirecta.com  

"Este mensaje y los documentos que, en su caso, lleve anexos, pueden contener informaci�n confidencial. Por ello, se informa a quien lo reciba por error que la informaci�n contenida en el mismo es reservada y su uso no autorizado est� prohibido legalmente, por lo que en tal caso le rogamos se abstenga de realizar copias del mensaje, leerlo, remitirlo o difundirlo y proceda a borrarlo inmediatamente." 

"This message is intended only for the use of the individual to whom it is addressed and may contain information that is confidential. If you have received this communication, by error, you are hereby notified that any distribution or copying of this communication is prohibited."   

Re: Posting several beans using JSON to a REST service

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi

Multiple REQUEST_BODY parameters are not supported in JAX-RS. Can you
have a ContainerBean which has both BeanA and BeanB embedded ?
The only exception is multiparts, each parameter may be mapped to an
individual part...

Cheers, Sergey

On Thu, Feb 10, 2011 at 3:00 PM, David Corral Sanz
<da...@lineadirecta.es> wrote:
> We have tried several approaches to invoke services that have a signature
> like:
>
> public void (BeanA, BeanB)
>
> but none have worked. So much so that we are really consiering if the
> feature is not implemented.
>
> Here's some sample pseudo-code of what we need:
>
> $.ajax({
>   type: "POST",
>   url: '...',
>   contentType: "application/json",
>   data: {"beanA":{}, "beanB":{}},
>   dataType: 'application/json',
> });
>
> <resource name="..." path="foo">
>    <operation name="bar" verb="POST" path="/baz">
>        <param name="xxx" type="REQUEST_BODY"/>
>        <param name="yyyy" type="REQUEST_BODY"/>
>    </operation>
> </resource>
>
> We've tried Jettison and Jackson providers (and no annotations anywhere).
> We were not able to send sucessufully more than one bean in a request. Any
> help? Thanks in advance
>
> Visítenos en:  www.lineadirecta.com
>
> "Este mensaje y los documentos que, en su caso, lleve anexos, pueden contener información confidencial. Por ello, se informa a quien lo reciba por error que la información contenida en el mismo es reservada y su uso no autorizado está prohibido legalmente, por lo que en tal caso le rogamos se abstenga de realizar copias del mensaje, leerlo, remitirlo o difundirlo y proceda a borrarlo inmediatamente."
>
> "This message is intended only for the use of the individual to whom it is addressed and may contain information that is confidential. If you have received this communication, by error, you are hereby notified that any distribution or copying of this communication is prohibited."