AnsweredAssumed Answered

How to Use ArcGIS Javascript API with IBM worklight - Proxy setting issue

Question asked by inubedev on Feb 25, 2015
Latest reply on Apr 7, 2015 by bsvensson-esristaff

Hi,

 

Trying to create a hybrid mobile application using IBM worklight and ArcGIS Kavascript APIs. We are trying to create a simple navigation app using ArcGIS.

 

While using navigation widget from ArcGIS we are facing problem with proxy setup. Is proxy setup mandatory?

 

The code is as follows

<script src="http://js.arcgis.com/3.12/"></script>

    <script>

      require([

        "esri/urlUtils", "esri/map", "esri/dijit/Directions",

        "dojo/parser",

        "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dojo/domReady!"

      ], function(

        urlUtils, Map, Directions,

        parser

      ) {

        parser.parse();

      

     

     

        //all requests to route.arcgis.com will proxy to the proxyUrl defined in this object.

        urlUtils.addProxyRule({

          urlPrefix: "http://route.arcgis.com",

          proxyUrl: "http://192.168.4.109:10080/ProxyServer/proxy.js"

        });

        urlUtils.addProxyRule({

          urlPrefix: "http://traffic.arcgis.com",

          proxyUrl: "http://192.168.4.109:10080/ProxyServer/proxy.js"

       

        });

 

 

  var url = urlUtils.arcgisUrl;

        url= url.replace("file:", "http:");

        urlUtils.arcgisUrl = url;

     

        var map = new Map("map", {

          basemap: "streets",

          center:[-98.56,39.82],

          zoom: 4

        });

 

 

 

 

        var directions = new Directions({

          map: map

        },"dir");

        directions.startup();

      });

    </script>

 

we get error message:

Route service description was not reached or recognized. Please check service URL and OR user credential

02-25 15:01:08.604: I/chromium(17307): [INFO:CONSOLE(192)] "RequestError: Unable to load file://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World?f=json status: 0", source: http://js.arcgis.com/3.12/init.js (192)

 

Need help to resolve this issue.

Outcomes