Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. {"id": 2, "result": {"Planet": {"Earth": 1, "Mars": 2,....
  2.  
  3. Map<String, Map<String, Integer>>
  4.  
  5. {"id": 1, "result": ["Planet", "Stars"], "error": null}
  6.  
  7. import com.google.gwtjsonrpc.common.AsyncCallback;
  8. import com.google.gwtjsonrpc.common.RemoteJsonService;
  9. import com.google.gwtjsonrpc.common.RpcImpl;
  10.  
  11. @RpcImpl(version=RpcImpl.Version.V2_0,transport=RpcImpl.Transport.HTTP_POST)
  12. public interface ControlService extends RemoteJsonService
  13. {
  14. RegisterValues RegisterValues = new RegisterValues(); //Used in the Second Example
  15.  
  16. public void connectedCNames( String [] Names, AsyncCallback<String[]> callback ); //FirstExample
  17.  
  18. public void myRegisterValues( String [] Names, AsyncCallback<Map<String,RegisterValues>> callback); //Second Example
  19. //public void myRegisterValues( String [] Names, AsyncCallback<Map<String,Map<String, Integer>> callback); //version that doesn't work but should
  20.  
  21. }
  22.  
  23. import com.google.gwtjsonrpc.common.AsyncCallback;
  24.  
  25. public class createPanel implements ChangeHandler{
  26.  
  27. public mainPanel{
  28.  
  29. //Some code setting up the panels
  30. service_ = GWT.create(ControlService.class);
  31. ((ServiceDefTarget) service_).setServiceEntryPoint("http://localhost:3900/services/ControlProxy.py");
  32.  
  33. service_.connectedNames( new String[0], new AsyncCallback<String[]>() {
  34.  
  35. public void onSuccess( String[] result)
  36. {
  37. //This works, it returns back a parsed JSON Object in the form of an array of strings as expected
  38. }
  39. public void onFailure(Throwable why)
  40. {
  41. myList_.addItem( "Server error!" );
  42. }
  43. });
  44. }
  45. }
  46.  
  47. {"id": 2, "result": {"Planet": {"Earth": 1, "Mars": 2,....
  48.  
  49. public void myRegisterValues( String [] Names, AsyncCallback<Map<String,Map<String, Integer>> callback);
  50.  
  51. service_.myRegisterValues( names, new AsyncCallback<Map<String,Map<String, Integer>>();
  52.  
  53. public void RegisterValues( String [] Names, AsyncCallback<Map<String,RegisterValues>> callback);
  54.  
  55. public class RegisterValues
  56. {
  57. int Earth;
  58. int Mars;
  59. //etc.
  60.  
  61. 02:18:48.395 [ERROR] Errors in 'generated://AF9BA58B045D92E7896CD657C9CC5FAF/example/client/GlibControlService_JsonProxy.java'
  62. 02:18:48.395 [ERROR] Line 18: INSTANCE cannot be resolved or is not a field
  63.  
  64. 02:18:48.398 [ERROR] Failed to create an instance of 'example.client.ControlService' via deferred binding
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement