Assign it to TestServiceAsync since that is what you make the call to on the
client side (hence the hole asynchronous part of AJAX).

On Fri, Apr 10, 2009 at 7:29 PM, Joe Hudson <[email protected]> wrote:

>
> Hi, I'm trying to figure out GWT-RPC and having a bit of an issue
> (details are below).  I will say that I have had success with GWT-RPC
> as long as I *was not* using any method parameters or return types
> that were objects of my own creation.  Is there something special that
> needs to be done to register these objects (they are under the
> "client" package)?  Any help would be greatly appreciated.  Thanks!
>
> I have the following service interface (in com.test.ui.client):
> @RemoteServiceRelativePath("test")
> public interface TestService extends RemoteService {
>        String test(String someParam);
> }
>
> and the following async service interface
> public interface TestServiceAsync {
>        void test(String someParam, AsyncCallback<String> callback);
> }
>
> and the following service implementation (in com.test.ui.server):
> public class TestServiceImpl extends RemoteServiceServlet implements
> TestService {
>        @Override
>        public String test(String someParam) {
>                return someParam + "-" + someParam;
>        }
> }
>
> these all reference the Test class (in com.test.ui.client.model.test):
> public class Test implements Serializable {
>        private String someProperty;
>
>        public String getSomeProperty() {
>                return someProperty;
>        }
>        public void setSomeProperty(String someProperty) {
>                this.someProperty = someProperty;
>        }
> }
>
> My module code looks like this:
>        public void onModuleLoad() {
>                Object obj = GWT.create(TestService.class);
>                System.out.println("The class is: " +
> obj.getClass().getName()); //
> outputs "The class is: com.test.ui.client.TestService_Proxy"
>
>                TestService testService = GWT.create(TestService.class); //
> here is
> where I receive a ClassCastException
>                Test test = new Test();
>                test.setSomeProperty("bar");
>                String rtn = testService.test("foo");
>                System.out.println("The value is: " + rtn);
>        }
>
> The problem I am having is that I am receiving a ClassCastException
> with this stack trace:
> [ERROR] Unable to load module entry point class
> com.test.ui.client.Ib_web (see associated exception for details)
> java.lang.ClassCastException: com.test.ui.client.TestService_Proxy
> cannot be cast to com.test.ui.client.TestService
>        at com.test.ui.client.Ib_web.onModuleLoad(Ib_web.java:28)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>        at java.lang.reflect.Method.invoke(Unknown Source)
>        at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:326)
>        at com.google.gwt.dev.shell.BrowserWidget.attachModuleSpace
> (BrowserWidget.java:343)
>        at com.google.gwt.dev.shell.ie.BrowserWidgetIE6.access$300
> (BrowserWidgetIE6.java:37)
>        at com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.gwtOnLoad
> (BrowserWidgetIE6.java:77)
>        at com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.invoke
> (BrowserWidgetIE6.java:161)
>        at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke
> (IDispatchImpl.java:294)
>        at com.google.gwt.dev.shell.ie.IDispatchImpl.method6
> (IDispatchImpl.java:194)
>        at org.eclipse.swt.internal.ole.win32.COMObject.callback6
> (COMObject.java:117)
>        at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
>        at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925)
>        at
> org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966)
>        at com.google.gwt.dev.SwtHostedModeBase.processEvents
> (SwtHostedModeBase.java:235)
>        at com.google.gwt.dev.HostedModeBase.pumpEventLoop
> (HostedModeBase.java:558)
>        at com.google.gwt.dev.HostedModeBase.run(HostedModeBase.java:405)
>        at com.google.gwt.dev.HostedMode.main(HostedMode.java:232)
> >
>

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