You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Luciano Resende <lu...@gmail.com> on 2008/09/08 21:54:40 UTC

Re: json-rpc Lists and arrays

If I understood it correctly, I've seen some similar issues, and the
cause was that the Service Interface was not annotated as with
@Remote, thus the data binding framework wasn't really intercepting
the calls and doing the proper conversion to json. Could you please
check that ?

On Mon, Sep 8, 2008 at 12:04 PM, Angel E Tomala Reyes
<ae...@us.ibm.com> wrote:
> Hi,
> I am interested in hearing on some suggestions on how to deal with
> serialized data coming from J2EE using tuscany. Here is the scenario:
>
> I have Java implementation component which has json-rpc-binding. On the
> client I have a dojo implementation which uses dojo-rpc component to get to
> our services. Service X is supposed send back an array of JavaBeans to the
> client. So I get all of that to work; However, when I get the array of
> JavaBeans, JavaScript is unable to deal with the object I get from tuscany.
> By that I mean, the array of JavaBeans is not an array, but rather an object
> which contains a number of JavaBeans which I can access as long as I say
> x[0], x[5], etc. I cannot access the container object as an array.
> In my java definition I have tried
>
> Reports[] getReports();
> and
> List<Reports> getReports();
>
> The first returns an object containing all of my Report objects inside of
> some wrapper, but the wrapper object looks nothing like an array. The second
> implementation returns an object which contains an attribute called list,
> which while it contains all of my results, it behaves nothing like and
> array. My goal in the client side is to be able to do the following:
>
> servce.methodCall().addCallBack(doSomething);
> ...
>
> doSomething: function (result){
> dojo.forEach(item, fucntion (items){ alert (item.x)});
> }
>
> The above example is oversimplified, but the bottom line is. If I pass
> results to dojo.forEach, dojo complaints that result is not an Array. Any
> recommendations as to what do i need to do to you java method definitions to
> make tuscany marshal the objects returned as an array of JavaBeans? or is
> there anything I can do to the result object to convert to an Array in
> JavaScript?
>
>
> Angel E. Tomala-Reyes
> IBM CHQ, Enterprise On Demand
> IQ Collaboration Team
> Software Engineer
> 15038 Union Turnpike 8F
> Flushing, NY 11367
> 1-877-564-9244 (T/L:3208066)



-- 
Luciano Resende
Apache Tuscany Committer
http://people.apache.org/~lresende
http://lresende.blogspot.com/