EGL Development User Group

EGL Development User Group

EGL Development User Group

The EGL Development User Group is dedicated to sharing news, knowledge, and insights regarding the EGL language and Business Developer product. Consisting of IBMers, HCL, and users, this community collaborates to advance the EGL ecosystem.

 View Only
  • 1.  Calling REST webservice from Cordova application

    Posted Thu May 03, 2018 10:13 AM

    Hello,

    I did some tests with the Cordova examples for barcode scanning.
    This test application is working fine on a Android Device.
    Next step was to execute a REST webservice from this Cordova Android application but strange errors appear in my backend project. 

    To be sure i created a smaller Frontend Cordova project with a handler with only a textfield a button and a textarea for the answer. 
    After clicking the button a REST webservice is executed and an answer is comming back. 

    When running this handler as a browser application, it works fine :


     

    When running it from a Android Device (which hase connection to the same Backend location using a VPN connection via FortiClient), 
    the frontend receives a CRRUI3658E. And internal server error:




    At the backend there is also an error now. Which is proof that the backend is triggered:  

    [3-5-18 15:43:26:114 CEST] 00000063 webapp        E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[restservices]: com.ibm.ws.webcontainer.webapp.WebAppErrorReport: SRVE0295E: Error reported: 500        at com.ibm.ws.webcontainer.webapp.WebAppDispatcherContext.sendError(WebAppDispatcherContext.java:626)        at com.ibm.ws.webcontainer.webapp.WebAppDispatcherContext.sendError(WebAppDispatcherContext.java:656)        at com.ibm.ws.webcontainer.srt.SRTServletResponse.sendError(SRTServletResponse.java:1255)        at com.ibm.ws.webcontainer.srt.SRTServletResponse.sendError(SRTServletResponse.java:1229)        at com.ibm.javart.services.RestServiceServlet.write(RestServiceServlet.java:288)        at com.ibm.javart.services.RestServiceServlet.doHttp(RestServiceServlet.java:198)        at com.ibm.javart.services.RestServiceServlet.doPost(RestServiceServlet.java:104)        at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)        at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)        at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1224)        at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:774)        at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:456)        at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)        at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1032)        at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3748)        at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)        at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:962)        at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)        at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:459)        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:526)        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:312)        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:283)        at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)        at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)        at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)        at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)        at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)        at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)        at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)        at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)        at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)        at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1814)[3-5-18 15:43:26:105 CEST] 00000063 SystemErr     R May 3, 2018, 3:43:26 PM.0  EGL1543E:EGL1543E No REST-RPC service was found. URL:/CordovaBackend/restservices/___proxyEGL0001I The error occurred in EGL REST Service servlet.    detail1:500    detail2:FAILED    detail3:

    This is the deployment descriptor:

     

    Anybody an idea what it can be? Did someone manage it to call a REST webservice from an EGL backend project?

     

    Greetings, Jeroen Dielemans
    amITs

     

    Jerrycan


  • 2.  Re: Calling REST webservice from Cordova application

    Posted Sun May 13, 2018 09:58 AM

    Hi Jeroen, the Service URI in your deployment descriptor should refer to a project which contains the EGLRichUIProxy servlet. Normally only Rich UI projects contain this servlet out of the box (check your web.xml). So I guess the easiest way in this case to accomplish this it to deploy your mobile project as a rui project as well. You only have to do this once. After that, refer to this project in your service URI and rebuild your app.

     

    Kind Regards,

    Arie

    Axians Zaltbommel

     

    Axians


  • 3.  Re: Calling REST webservice from Cordova application

    Posted Wed May 16, 2018 03:33 AM

    Hello Arie, 

    Thanks for your feedback.

    At the moment i have a
    - EGL Backend project (with REST services), with the name CordovaBackend
    - EGL Mobile Frontend project, with the name CordovaFrontend
    - Corodva Web project (The frontend deploys to this project for Cordova) with the name cordovaDeploy
    - J2EE web module project (The frontend deploys to this project for Web) with the name cordovaDeployWeb

    I read this blog once more https://www.ibm.com/developerworks/community/blogs/3e2b35ae-d3b1-4008-adee-2b31d4be5c92/entry/Develop_Hybrid_Mobile_App_with_EGL?lang=en

    Do i understand you right that, when developping a mobile Cordova app, this app can't talk straight to the backend but has to talk to the J2EE web project first. And that this project has
    to take care of the communication to the backend rest services?

    Greetings, Jeroen.

     

     

    Jerrycan


  • 4.  Re: Calling REST webservice from Cordova application

    Posted Wed May 16, 2018 04:25 PM

    Hi Jeroen

    The proxy servlet should be in your rui project. In this case cordovaDeploy if I get it right. Check the web.xml for it in this project.

    If so, deploy that project to the same server and refer to that project as being the serviceURI. So I guess this should be: http://172.20.154.110:9080/cordovaDeploy

    Regards, Arie

    Axians

    Axians


  • 5.  Re: Calling REST webservice from Cordova application

    Posted Fri May 18, 2018 09:40 AM

    Hello Arie,

    that did the trick indeed. Thanks! I have changed the service Uri to http://172.20.154.110:9080/cordovaWebDeploy and that was all. 

    Thanks for your support!
    Regards, Jeroen
    amITs

    Jerrycan