You should declare your service method to return "ArrayList<String>" and not "List<String>". Best practice for GWT is different from general Java best practice because using less-specific classes forces the GWT compiler to generate serialization code for every serializable subclass of List.
It may not fix your problem, but you should do it anyway. Paul On 10/08/11 15:51, BM wrote:
So I created two test methods to see if my POJO has a problem or not. I am not even using my POJO but arraylist of String objects just to make things simpler now. 1) Verified that my gwt.xml does have following. <source path="client" /> <source path="shared" /> 2) I created a simple Test RPC classes (MergeService, MergeServiceAsync and MergeServiceImpl). 3) Implementation code inside MergeServiceImpl contains two methods. public String testMethod() { return "Hello World"; } public List<String> testMethod2() { ArrayList<String> myList = new ArrayList<String>(); myList.add("hello1"); myList.add("world2"); return myList; } 4) In the activity class I have following code: clientFactory.getMergeServiceAsync().testMethod(new AsyncCallback<String>() { @Override public void onSuccess(String result) { Window.alert("testMethod - onSuccess"); } @Override public void onFailure(Throwable caught) { caught.printStackTrace(); Window.alert("testMethod - onFailure"); } }); clientFactory.getMergeServiceAsync().testMethod2(new AsyncCallback<List<String>>() { @Override public void onSuccess(List<String> result) { Window.alert("testMethod2 - onSuccess"); } @Override public void onFailure(Throwable caught) { caught.printStackTrace(); Window.alert("testMethod2 - onFailure"); } }); 5) When I run the code, it executes Window.alert("testMethod - onSuccess") and Window.alert("testMethod2 - onFailure"). So deserializing String object works but deserializing an ArrayList of String objects (ArrayList does not even contain my POJO now but plain simple String object) did not work in GWT 2.3 Is this a bug in GWT 2.3? What am I really missing here? On Aug 10, 9:38 am, Alex Dobjanschi<[email protected]> wrote:You're really not showing us the code. Please follow the guidelines then, and check one by one.
-- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
