I am new in GWT and I tried to create an application on testing RPC.
It prompts 404 Error (RequestURI=sample/myService) in Host Mode of
Eclipse. Can anyone help me? Below are my codes. Thank you very much.

**************Sample.java *********************** (Client program to
call RPC)

public class Sample implements EntryPoint {


        MyServiceAsync myService = (MyServiceAsync)
GWT.create(MyService.class);
        ServiceDefTarget endpoint = (ServiceDefTarget) myService;
        String moduleRelativeURL = GWT.getModuleBaseURL() + "myService";
        endpoint.setServiceEntryPoint(moduleRelativeURL);

        AsyncCallback callback = new AsyncCallback()
        {
            public void onSuccess (Object result)
            {
                success = true;
                Window.alert(result.toString());
            }

            public void onFailure (Throwable ex)
            {
                calendar.setData(CalendarOverlappingData.getRecords());
                Window.alert(ex.toString());
            }
        };

        myService.myMethod("sa", "sa", callback);


}


******************* MyServiceAsync.java ****************
public interface MyServiceAsync {
        void myMethod(String userName, String passWord, AsyncCallback<String>
callback)
                        throws IllegalArgumentException;
}

******************MyService.java ********************

@RemoteServiceRelativePath("myService")
public interface MyService extends RemoteService {
        String myMethod(String name, String passWord) throws
IllegalArgumentException;
}

******************MyServiceImpl.java ********************
public class MyServiceImpl extends RemoteServiceServlet implements
MyService
{


        private static final long serialVersionUID = 1L;
        String success;
        boolean flag=false;


public String myMethod(String userName, String passWord) {

                success="OK";
                return success;
}

}


****************************Sample.gwt.xml *********************


  <!-- Specify the app entry point class.                         -->
  <entry-point class='com.sample.client.Sample'></entry-point>
  <servlet path="/myService" class="com.sample.server.MyServiceImpl"/
>
  <!-- Specify the paths for translatable code                    -->
  <source path='client'/>
  <source path='shared'/>

**************************web.xml****************************

  <!-- Servlets -->

    <servlet>
        <servlet-name>myService</servlet-name>
        <servlet-class>com.sample.client.MyServiceImpl</servlet-
class>
    </servlet>

    <servlet-mapping>
        <servlet-name>myService</servlet-name>
        <url-pattern>/myService</url-pattern>
    </servlet-mapping>


  <!-- Default page to serve -->
  <welcome-file-list>
    <welcome-file>Sample.html</welcome-file>
  </welcome-file-list>

</web-app>

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