Hi all,
It's a bit embarrassing, but the simplest RPC example (from
http://www.thescreencast.com/2007/08/gwt-rpc-in-eclipse.html) will not
work in my environment. I created a new Eclipse Project and merged the
KitchenSink example in my own code (I really like the layout).
Everything worked fine, so I decided to move on to RPC.
All examples are copied from the screencast:
Service interface:
package client;
import com.google.gwt.user.client.rpc.RemoteService;
public interface MyService extends RemoteService{
public String greeting(String helloTo);
}
Service implementation @ server side:
package server;
import client.MyService;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
public class MyServiceImpl extends RemoteServiceServlet implements
MyService {
@Override
public String greeting(String helloTo) {
return "Hello "+helloTo+" from
"+getServletContext().getServerInfo();
}
}
My automanager.gwt.xml:
<module>
<inherits name='com.google.gwt.user.User'/>
<entry-point class='client.automanager'/>
<stylesheet src='automanager.css' />
<servlet path="/greeting" class="server.MyServiceImpl" />
</module>
And the asynchronous interface:
package client;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.RemoteService;
public interface MyServiceAsync {
public void greeting(String helloTo, AsyncCallback<String> callback);
}
In automanager.java I added the following method which was linked to a
button click:
public void remoteGreetingLabel(final Label label){
MyServiceAsync greetingService = (MyServiceAsync)
GWT.create(MyService.class);
ServiceDefTarget endpoint =
(ServiceDefTarget)greetingService;
String moduleRelativeURL =
GWT.getModuleBaseURL()+"greeting";
endpoint.setServiceEntryPoint(moduleRelativeURL);
AsyncCallback callback = new AsyncCallback(){
@Override
public void onFailure(Throwable caught) {
System.out.println("Error: " +
caught.getMessage());
}
@Override
public void onSuccess(Object result) {
label.setText((String)result);
}
};
greetingService.greeting("GWT-client", callback);
}
By commenting the AsyncCallback object, everything runs fine (ofcourse
without the whole RPC thing), by uncommenting it I get the following
errors:
[TRACE] Compiling Java source files in module 'automanager'
[TRACE] Removing units with errors
[ERROR] Errors in 'file:/C:/workspace/automanager/src/client/
automanager.java'
[ERROR] Line 99: The method onFailure(Throwable) of type new
AsyncCallback(){} must override a superclass method
[ERROR] Line 105: The method onSuccess(Object) of type new
AsyncCallback(){} must override a superclass method
[TRACE] Finding entry point classes
[ERROR] Unable to find type 'client.automanager'
[ERROR] Hint: Previous compiler errors may have made this type
unavailable
[ERROR] Failure to load module 'automanager'
Anyone?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---