esri.config.defaults.io.useCors = true; esri.config.defaults.io.corsEnabledServers.push("analysis.arcgis.com"); //esriConfig.defaults.io.proxyUrl = "http://localhost/esriProxy/proxy.ashx?" esri.config.defaults.io.proxyUrl = "http://localhost/esriProxy/"; var server = new ServerInfo({ server: "http://analysis.arcgis.com", tokenServiceUrl: "https://www.arcgis.com/sharing/generateToken" // I saw the below on my esri.id.server //adminTokenServiceUrl: "http://analysis.arcgis.com/arcgis/admin/generateToken" }) var loginDeferred = esri.id.signIn("http://analysis.arcgis.com", server); loginDeferred.then(function (response) { esri.id.registerToken(response); }) $("#searchButton").click(function () { var gp = new Geoprocessor("http://analysis.arcgis.com/arcgis/rest/services/tasks/GPServer/FindNearest"); var params = //skipped for space but I know these are fine gp.submitJob(params, completeCallback); }
<?xml version="1.0" encoding="utf-8" ?> <ProxyConfig allowedReferers="*" mustMatch="true"> <serverUrls> <serverUrl url="http://services.arcgisonline.com" matchAll="true"/> <serverUrl url="http://analysis.arcgis.com" matchAll="true"/> </serverUrls> </ProxyConfig>
if (url.indexOf("utilities-infrastructure")>-1||url.indexOf("utilitiesinfrastructure")>-1) { function myCallbackFunction(ioArgs) { ioArgs.content = ioArgs.content || {}; if (esri.id) { if (esri.id.credentials[0]) { if (esri.id.credentials[0].token) { ioArgs.content.token = esri.id.credentials[0].token; } } } return ioArgs; } esri.setRequestPreCallback(myCallbackFunction); }
Request URL: https://localhost/esriProxy/proxy.ashx?https://analysis.arcgis.com/arcgis/rest/services/tasks/GPServer/FindNearest/submitJob?f=json&analysisLayer={"layerDefinition "You do not have permissions to use this resource."
<?xml version="1.0" encoding="utf-8" ?> <ProxyConfig allowedReferers="*" mustMatch="false"> <serverUrls> <serverUrl url="http://services.arcgisonline.com" matchAll="true"/> <serverUrl url="http://analysis.arcgis.com" matchAll="true"/> </serverUrls> </ProxyConfig> <!-- See https://github.com/Esri/resource-proxy for more information -->
var connectingLines = esriRequest({ url: url, content: { f: "json", token: token} });
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.