Select to view content in your preferred language

'Difference'  in 'geometryservice' not working when app is on apache server

1964
10
05-09-2014 08:18 AM
NubianConsulting
Emerging Contributor
Dear All,

I am writing here to enquire whether others who use ArcGIS API for Javascript have also had the following problem, and if so, whether you could advise on a solution.

The Problem: The 'difference' method under the 'geometryservice' class works on my machine locally (when I run the javascript from dreamweaver), but when I put the html file on my server and try to access it online, the method does not work and returns the error message.

This is puzzling because I have another geometry service - 'buffer', which works on both my local machine and when on the server.

Other points:
- url sourcing javascript theme: http://js.arcgis.com/3.9/js/dojo/dijit/themes/claro/claro.css
- url sourcing javascript api: http://js.arcgis.com/3.9/js/esri/css/esri.css
- url sourcing other javascript esri info: http://js.arcgis.com/3.9/
- link to geometry service api reference page: https://developers.arcgis.com/javascript/jsapi/geometryservice.html

Any advice or pointers would be very much appreciated. Please do let me know if you require more information/ code snippets and I would be more than happy to do so.

Kind Regards,

Naveen
0 Kudos
10 Replies
JohnGravois
Deactivated User
hi naveen,

what is the error message?
what status code is returned by ArcGIS Server?
can you share a simplified application which demonstrates the problem?
can you share the problematic request itself?
0 Kudos
NubianConsulting
Emerging Contributor
Hi John Gravois,

There is not an error message when I run the program on the server, the difference method just doesn't execute. I put in an error message into the errback to warn me if the method is even being read - 'difference(geometries,geometry,callback?,errback?)'.

Please see an excerpt of the relevant code attached. To illustrate the problem, please hover the mouse over the news article with the date '140601' and title 'Indian companies strike gas in Libya's Ghadames Basin'. I have added alert messages to notify when the correct stages are passed. The total process shouldn't take more than 10 seconds when working. As before, this works on my local machine (using dreamweaver), but not when on the apache server. 

Thank you very much for the time.

Naveen
0 Kudos
NubianConsulting
Emerging Contributor
Also, if you wish to see an example when the file is on the server, please use: http://81.136.156.9/app/excerpt.html. The username is: guest, and password is: password.

Thanks,

Naveen
0 Kudos
JohnGravois
Deactivated User
naveen,

the json file in your application 404s when I try and run here, so i'm not able to run your application.

that being said in looking at your code i noticed two things that seemed a little irregular.

1. why are you instantiating two different geometry service objects?
gsvc = new GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"); 
gs   = new GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");  

2. i think you should either be supplying an anonymous function inline as the callback to difference() or referencing a named function that appears later.  right now you're doing both.
gs.difference(geom11,geom1a,function showCutBuffer(graphic1a1){
//should be either
gs.difference(geom11,geom1a,function(graphic1a1){
...
//or
gs.difference(geom11,geom1a,showCutBuffer);
...
function showCutBuffer(graphic1a1)
0 Kudos
NubianConsulting
Emerging Contributor
Hi John,

Unfortunately these amendments do not fix the problem either. I am quite sure it is something specifically to do with how the geometry service class is accessed from a server, but I have no idea what. Do you have geometry service examples which work when on a server which I could test, and then maybe double check where I am going wrong?

Thanks,

Naveen
0 Kudos
JohnGravois
Deactivated User
Naveen,

if you can upload the JSON file used in your sample application I can host it myself and see if I can reproduce the problem.
0 Kudos
NubianConsulting
Emerging Contributor
The json file is the following url: http://81.136.156.9/app/jsonTemp1.json

the username is: 'guest', and password: 'password'

Thank you very much!

Best,

Naveen
0 Kudos
JohnGravois
Deactivated User
the JSON object for date '140601' is not present in the JSON file you provided (or the sample app you have running on your own site).

for me, the code fails to call queryTask.execute() when hovering over other dates (because licenceref1 == "")

a simpler repro case with a hardcoded call to the geometry service would make it a lot easier to debug and attempt to give you some feedback.
0 Kudos
NubianConsulting
Emerging Contributor
Hi John,

The 140106 is coming up for me - maybe the html has to be refreshed? I am attaching the json file just incase if that's okay?

Thanks,

Naveen
0 Kudos