Export to Excel

575
1
03-08-2013 06:12 AM
SamirGambhir
Occasional Contributor III
Hi,
I am using ArcGIS Server 10.1 JavaScript API 3.2.

I have a Java code on a remote server which can take JSON array from my application and convert it to an Excel spreadsheet. My application is hosted on Amazon Cloud. Each time I make a call to the remote server using xmlHttp request, it rejects it with the error 404 (not found). I understand it could be a cross domain issue, and we tried putting a header in our Java code such as  'header(�??Access-Control-Allow-Origin: http://myWebAppAddress�?�)' but it did not work. We also tried placing the code in my local server and tried it with local insttall of my app and it failed again. However, if I create a string for the URL for the remote server and place it in the adress bar of my browser, the Java code executes and downloads the excel file on my machine. Javascript console message provides me the request URL as "http://localhost:8080/myApFolderOnTomcat/"http://remoteIP:8080/codeFolderName/exportData.do?jsonText={....}". Is it normal for the request header to have my local host address as well? I'll really appreciate it if someone can help me resolve this.
Thanks
Samir
0 Kudos
1 Reply
RahulMetangale1
Occasional Contributor II
Hi Samir,

to narrow down the issue. Place a simple image in the root of server hosting your java app. Now try accessing the image from Amazon server, if you are able to access/view the image on Amazon server then you can eliminate accessibility issue. Also if you are making cross domain request, then before going into CORS I would suggest you try a making request using esri.request with useProxy flag true. This will take care of cross domain issue.

Once this is resolved you can move on to CORS.

I hope this helps.

Rahul
0 Kudos