0

RPC call runs successfully in my localhost and when i pushed the project with phonegap integration and tested out in android emulator Rpc call fails and throws status exception 0 or gwt rpc Object not found-404. I did refer tutorial from gwt phonegap rpc-Daniel and did changes like mentioned in above tut:

final ServiceDefTarget serv=(ServiceDefTarget)checkuser;
Window.alert(serv.getServiceEntryPoint());
PhonegapUtil.prepareService(serv,"http://myip:8888/plac/reg","reg");

Where plac is my project space where it resides and reg is URLPattern. I end up either with status code 0 exception or StatusCodeException 404 Notfound.

Please let me know where I am wrong.

Web.xml:

<!-- Servlets -->
<servlet>
<servlet-name>Register</servlet-name>
<servlet-class>com.plac.server.Register</servlet-class>
</servlet>  
<servlet-mapping>
<servlet-name>Register</servlet-name>
<url-pattern>/plac/reg</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Register</servlet-name>
<url-pattern>/plac/signup</url-pattern>
</servlet-mapping>  
Stéphane B.
  • 3,260
  • 2
  • 30
  • 35
Rangesh
  • 728
  • 2
  • 12
  • 27

3 Answers3

2

Your code needs to look like this:

PhonegapUtil.prepareService(serv,"http://myip:8888/plac/","reg");

The first parameter is the url to your module in your case this should be:

"http://myip:8888/plac/"

and the relative url of your service (to your module)

"reg"
Daniel Kurka
  • 7,973
  • 2
  • 24
  • 43
0

Try to add pattern:

<!-- Servlets -->
<servlet>
<servlet-name>Register</servlet-name>
<servlet-class>com.plac.server.Register</servlet-class>
</servlet>  
<servlet-mapping>
<servlet-name>Register</servlet-name>
<url-pattern>/plac/reg</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Register</servlet-name>
<url-pattern>/plac/reg/*</url-pattern>
</servlet-mapping>

You may have a / appended to you URL. In that case you'll get a 404.

Do you run in an phonegap environment?

If yes ensure to allow a wildcart access to server: PhoneGap external hosts wildcard

Community
  • 1
  • 1
Christian Kuetbach
  • 15,850
  • 5
  • 43
  • 79
0

I just had the same problem which kept me struggling for lots of hours. At some point I came across the solution which looks a bit different from the one above:

When you call http://myip:8888/plac/reg from a browser it should return HTTP Status 405 - HTTP method GET is not supported by this URL, if it refers to the desired service. Otherwise the url is missing something - looking at the resources you provided I am guessing the name of your GWT web app is missing.

Try http://myip:8888/YourAppName/plac/reg whereas http://myip:8888/YourAppName is the url you use to pull up your GWT app from a browser.

So, the code should look like this: PhonegapUtil.prepareService(serv,"http://myip:8888/YourAppName/plac/","reg");

Hope this helps.

Sir Hackalot
  • 521
  • 6
  • 16