Hi Jean,

thanks for the contrib that you have contributed.

I am learning how RpcJavaPojo works with qooxdoo frontend.

2 Feedbacks from me.

1. The Running of test

In your code has also provided a class named TestController for server
test.
And I ran the test against the TestController on RpcJavaPojo backend.

The test cases in TestController all passed EXCEPT for the
getArrayInteger().

    public int[] getArrayInteger() throws RemoteException {
        return new int[]{1, 2, 3, 4};
    }

If I change the return type into Integer[] e.g. 

    public Integer[] getArrayInteger() throws RemoteException {
        return new Integer[]{1, 2, 3, 4};
    }
It works. 
Looks like RpcJavaPojo does not handle the Java primitive data type ?

The JavaScript code for testing is :
    method = "getArrayInteger";
    alert("calling '" + method +"'");
    result = rpcController.callSync(method);
    alert("sync. call getArrayInteger {"+result+"}");
    alert("Returns an array: " +
         ((typeof(result) == "object") &&
         (result instanceof Array)));

Request JSON:
{"service":"services.TestController","method":"getArrayInteger","id":33,
"params":[]}

Result JSON:
{"error":null,"id":33,"result":{}}


2. Working with JSON Object
I had a further Querstion about how RpcJavaPojo handles the JavaScript
Object comes as request parameter from the qooxdoo client and what will
be sent back to client as result?

I have done a test on that: the service method on backend: 

Public Map echoMap(Map input){
        Return input;
}
And the calling javascript code on client is:

var addr = new Object();
addr.Vorname="Erika";
addr.Nachname="Mustermann";                             
addr.Strasse="Musterstrasse";
addr.Nummer=1;
addr.plz="1000";
addr.Stadt="Musterstadt";                               
// send an object
rpc.callAsync(echoMapHandler, "echoMap", addr);
 
The request and result of JSON look like:

Request:
{"service":"services.test","method":"echoMap","id":47,"params":[{"Vornam
e":"Erika","Nachname":"Mustermann","Strasse":"Musterstrasse","Nummer":1,
"plz":"1000","Stadt":"Musterstadt"}]}

Result:
{"error":{"message":"novlog.rpc.RpcException: Bad arguments for method
echoMap","origin":1,"class":"novlog.rpc.RpcException","cause":{"message"
:"novlog.serialization.UnserializationException: Cannot unserialize
java.util.HashMapto a
map","class":"novlog.serialization.UnserializationException","origMessag
e":"Cannot unserialize java.util.HashMapto a
map"},"code":5,"origMessage":"Bad arguments for method
echoMap"},"id":47,"result":null}

The tests are run with qooxdoo-1.1-sdk.

Best Regards,
Daojun



------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to