On 22 Jul., 15:39, Jens <[email protected]> wrote:
> Sure you can and its totally fine to do so. Just make sure that all methods
> are defined in the service interface and in its async interface.
>
> The exception you have received indicates that your browser uses some old
> cached javascript file (so clear your cache and reload the site) or your
> have forgotten to put your getName2() method into the service interface.
Thank for your help so far. I clear the cache with no effect. Maybe i
show you my other classes.
I think the service interface have to be correct. the problem might be
by calling the service?
I call both method, test1() and test2() and only test1() get served.
@RemoteServiceRelativePath("SpeicherService")
public interface SpeicherService extends RemoteService {
String getName(String name);
String getName2(String name2);
public static class Util {
private static SpeicherServiceAsync instance;
public static SpeicherServiceAsync getInstance(){
if (instance == null) {
instance = GWT.create(SpeicherService.class);
}
return instance;
}
}
}
public interface SpeicherServiceAsync {
void getName(String name, AsyncCallback<String> callback);
void getName2(String name2, AsyncCallback<String> callback);
}
public void test(String ausgabe) {
AsyncCallback<String> callback = new AsyncCallback<String>() {
@Override
public void onFailure(Throwable caught) {
System.out.println("Server Fehler");
caught.printStackTrace();
}
@Override
public void onSuccess(String result) {
Window.alert(result);
}
};
SpeicherService.Util.getInstance().getName(ausgabe, callback);
}
public void test2() {
AsyncCallback<String> callback = new AsyncCallback<String>() {
@Override
public void onFailure(Throwable caught) {
System.out.println("Server Fehler");
caught.printStackTrace();
}
@Override
public void onSuccess(String result) {
Window.alert(result);
}
};
SpeicherService.Util.getInstance().getName2("miau",callback);
}
> I don't know if you already know it, but try to avoid using general
> interfaces in your RPC method signature (e.g. List) because GWT has to
> generate code for every possible implementation of these interfaces (because
> GWT does not know which implementation you will choose). So in case of List
> its better to directly use ArrayList of whatever List implementation you
> would like to use in the method signature.
You mean something like this, or is it ok?
public static class Util {
private static SpeicherServiceAsync instance;
public static SpeicherServiceAsync getInstance(){
if (instance == null) {
instance = GWT.create(SpeicherService.class);
}
return instance;
}
}
--
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.