Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Using RemoteServiceServlet in a mobile application with phonegap

    I am trying to use RemoteServiceServlet within a mobile app. (GWT 2.7.0)

    Server Side :
    public class MyRpcServiceImpl extends RemoteServiceServlet implements MyRpcService{

    private static final long serialVersionUID = 1L;

    @Override
    public String getString(String widgetRequest)
    throws IllegalArgumentException {
    return "String from server";
    }

    }

    App Side :
    public void onModuleLoad() {
    myRpcServiceAsync.getString("", new AsyncCallback<String>(){

    @Override
    public void onFailure(Throwable caught) {
    SC.warn(caught.getMessage() + "\n" + caught.toString());
    }

    @Override
    public void onSuccess(String result) {
    SC.say(result);
    }

    });
    ....

    Works fine when I test under eclipse/Jetty.

    When I deploy to PhoneGap (developper) and test, I receive the message from SC.warn...

    WARNING
    0
    com.google.gwt.user.client.rpc.StatusCodeException
    0

    It looks like node.js is not able to handle my servlet.
    I cannot see any error message in phonegap log.

    Could you help ?
    Any other way to use Jetty/Tomcat instead of node.js within Phonegap.

    I would save redevelopping backend services if I could make it work.

    Thanks for help




    #2
    Hello,

    I have a missing link
    1. smartgwt.mobile project is deployed by Eclipse to the cloud where GAE generate javascript + html pages for browsers
    2. when I developed phonegap projects I put 100% javascript in the package for app generators, all locally.
    I never used localy the java to javascript generator. How did you start it ?

    Regarding your problem I do not understand the server part. Shouldn't be something like this ?
    Code:
    public class CountriesDataProviderServlet extends HttpServlet{
        @Override
        protected void doPost( HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
                    .... prepare data for the client and send it ....    
        }
         .... doGet ....
    }
    There are some examples in the showcase

    Comment

    Working...
    X