d[c][2] is not a function
I'm getting a Javascript error when trying to call a service. Many other services are working but a handful are throwing "is not a function" errors. Details below. Greg GWT 2.0.3 Javascript ERROR: 2010-04-29 12:49:33,503 [ERROR] Database:service.updateMPG com.google.gwt.core.client.JavaScriptException: (TypeError): d[c][2] is not a function MLServiceAsync.java void updateMPG(MidwarePropertyGroupDTO entity, AsyncCallback callback); MLService.java public MidwarePropertyGroupDTO updateMPG(MidwarePropertyGroupDTO entity); Database.java final AsyncCallback callback = new AsyncCallback() { public void onFailure(Throwable caught) {} public void onSuccess(MidwarePropertyGroupDTO result) {} }; MLServiceAsync service = (MLServiceAsync) GWT.create(MLService.class); try { service.updateMPG(entityDTO, callback); } catch (Throwable t) { log.error("service.updateMPG", t); } -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Asynchronous communication from server to client
I've started using timers combined with a state/transition matrix. I've offered a simple example below. The basic idea is to keep a 'state' variable with the current state in the program logic. When you initiate a asynchronous call, you move the state to "LOADING". When the call is complete, you move the state to "RUNNING". You can easily chain requests (as in the example) by pushing the state from "LOADING_WS1_DATA" to "DONE_LOADING_WS1_DATA" to "LOADING_WS2_DATA" to "DONE_LOADING_WS2_DATA" finally back to "RUNNING". Example follows: package com.test.client; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.ClickListener; import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.Widget; public class GWTProcess implements EntryPoint { private static final int ERROR = -2; private static final int INIT = -1; private static final int RUNNING = 0; private static final int BUILD_GUI = 100; private static final int START_LOADING_DATA = 200; private static final int LOADING_WS1_DATA = 300; private static final int DONE_LOADING_WS1_DATA = 301; private static final int LOADING_WS2_DATA = 400; private static final int DONE_LOADING_WS2_DATA = 401; private static final int DISPLAY_DATA = 500; int state = INIT; String result1 = ""; String result2 = ""; public void onModuleLoad() { Timer t = new Timer() { public void run() { if (state == INIT) { initialize(); state = BUILD_GUI; } else if (state == BUILD_GUI) { buildGui(); state = RUNNING; } else if (state == RUNNING) { // do nothing special } else if (state == START_LOADING_DATA) { fireWebServiceOne(); state = LOADING_WS1_DATA; } else if (state == LOADING_WS1_DATA) { // wait patiently } else if (state == DONE_LOADING_WS1_DATA) { state = LOADING_WS2_DATA; } else if (state == LOADING_WS2_DATA) { fireWebServiceTwo(); state = LOADING_WS2_DATA; } else if (state == LOADING_WS2_DATA) { // wait patiently } else if (state == DONE_LOADING_WS2_DATA) { state = DISPLAY_DATA; } else if (state == DISPLAY_DATA) { displayData(); state = RUNNING; } else if {state == ERROR) { Window.alert("ERROR READING WEBSERVICE"); state = RUNNING; } } }; // Schedule the timer to every 100 milliseconds. t.scheduleRepeating(100); } private void initialize() { // nothing to do } private void buildGui() { Button b = new Button("Click me", new ClickListener() { public void onClick(Widget sender) { Window.alert("start data load"); state = START_LOADING_DATA; } }); RootPanel.get().add(b); } private void displayData() { Window.alert(result1+":"+result2); } private void fireWebServiceOne() { WebServiceOneAsync webservice = GWT.create (WebServiceOne.class); AsyncCallback callback = new AsyncCallback() { public void onFailure(Throwable caught) { state = ERROR; } public void onSuccess(String results) { result1 = results; state = DONE_LOADING_WS1_DATA; } }; webservice.getData(callback); } private void fireWebServiceTwo() { WebServiceOneAsync webservice = GWT.create (WebServiceOne.class); AsyncCallback callback = new AsyncCallback() { public void onFailure(Throwable caught) { state = ERROR; } public void onSuccess(String results) { result2 = results; state = DONE_LOADING_WS2_DATA; } }; webservice.getData(callback); } } --~--~-~--~~~---~--~~ You rec