On Wed, Sep 10, 2008 at 4:56 PM, Kevin <[EMAIL PROTECTED]> wrote:
> "For the same reason, asynchronous methods do not have return types;
> they must always return void."
>
> So, to use a method with an RPC, am I just doing the following?

I think the problem you're having is that you expect a method to
return its result directly, rather than via a callback.  RPC in GWT is
asynchronous, which means that, when the client side of the invocation
is finished, there isn't a result yet--you're still waiting for the
server to compute a result and return it.  That's the reason for the
AsyncCallback--you need to pass in an event handler that can deal with
the server's result when the client receives it.

I'm not sure if it'll help because you might not be in the target
audience, but try reading
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/faca1575f306ba0f/3be719c021aa19bd
and see if it makes things any clearer.

Basically, RPCs return their values on the client by invoking the
onSuccess method of the AsyncCallback you pass in when you invoke the
RPC.  Unless you're into deep magic, there's nothing useful for an RPC
to return at the moment that you invoke it, which is why they all
return void.

On the server side, things are a little different.  From the server's
perspective, RPC is synchronous--the server receives a request, it
computes the result, and then replies with that result.  That's why
the the RemoteServiceServlet implementation you write must implement
the non -Async service interface.  So, on the server, you just
implement the RPC method like any other method--take in some
arguments, compute a result, and return it.

HTH,
Ian

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to