Select to view content in your preferred language

Creating Reports using ArcGIS hosted Service Proxies

1886
2
05-25-2017 01:13 PM
MarcRutzen
Deactivated User

Hello, I am currently trying to write a javascript program to Create Reports using an ArcGIS hosted Service Proxy. I currently have an issue in that anytime I send a url using an esrirequest, instead of sending an empty string it send the file location of wherever reportfinder.js is in my computer. This is a problem because the service proxy sends a url of the form "https://utility.arcgis.com/usrsvcs/appservices/proxyno/rest/services/World/GeoenrichmentNo./GeoEnric... ", making it so that all that I could put in afterwards would be the search terms for the report rather than an actual url. Is there any way to send an empty url for esri request? If not, is there any other way to Create Reports using the ArcGIS hosted Service Proxies?

My code is attached, with the server number and referred site redacted for privacy reasons.

0 Kudos
2 Replies
MirHashmi
Frequent Contributor

Marc,

1. You are trying to use an ArcGIS hosted proxy service

2. Also, an ESRI hosted map service

If i did understand your issue correctly,   I think the service URL needs to be passed separately than the proxy service URL. After i made a few changes to your code as below.

require(["esri/config"], function(esriConfig) {
esriConfig.defaults.io.proxyUrl = "/proxy/"
esriConfig.defaults.io.alwaysUseProxy = true
Referrer = "https://referredwebsite.com/"
});
require(["esri/IdentityManager"], function(IdentityManager){});
require(["esri/request"], function(esriRequest) {
var request = esriRequest({
// Service parameters if required, sent with URL as key/value pairs
url: 'https://utility.arcgis.com/usrsvcs/appservices/proxyno/rest/services/World/GeoenrichmentNo./GeoEnric...[{"sourceCountry":"US","layer":"US.Places","ids":["4850256,2253545"]}]&report=community_profile&reportFields={"title": "My Report","subtitle": "Produced by Company X"}&f=bin&format=PDF',
});
request.setRequestHeader('')
request.then(requestSucceeded, requestFailed)
});

function requestSucceeded(data) {
console.log("Data: ", data); // print the data to browser's console
}

function requestFailed(error) {
console.log("Error: ", error.message);
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
MarcRutzen
Deactivated User

Thank you for your help. Eventually I found that the arcgis proxy was too buggy, so I just created a custom proxy to query ESRI.

0 Kudos