I've published a simple geoprocessing service that takes an uploaded zip file and unzips it. The geoprocessing service was published with "uploads" enabled. I have also enabled "Info" level messaging, but nothing gets logged so that's been useless. When I run the GP service in ArcMap, it runs perfectly fine and does what I expect it to do. When I try running from the rest API, I get a failure message. When I try running from the JavaScript API, I get a failure message also that's a little more detailed, it says I have an Invalid URL but I'm not sure what URL it's evaluating...
Rest API input (I'm not entirely sure I'm inputting it right so it could be that):
After clicking "Submit Job (POST)", I get this:
In the JavaScript API, this is my code:
require([
"esri/map",
"esri/request",
"esri/arcgis/utils",
"esri/layers/FeatureLayer",
"esri/tasks/Geoprocessor",
"dojo/dom",
"dojo/on",
"dojo/domReady!"
],
function(
Map,
esriRequest,
arcgisUtils,
FeatureLayer,
Geoprocessor,
dom,
on
) {
var map = new Map("map", {
basemap: "hybrid",
center: [-77.069, 36.950],
zoom: 14
});
var featureLayer = new FeatureLayer("https://www.myurl.org/xxx/rest/services/HbMonitoringTest/HabitatData/MapServer/1");
map.addLayer(featureLayer);
gp = new Geoprocessor("https://www.myurl.org/xx/rest/services/Web_Map_GP_Services/ZipTest/GPServer");
on(dom.byId("upload"), "click", upload);
function upload(){
//upload the zip file and get back the itemID (via uploadSucceeded)
var upload = esri.request({
url: "https://www.myurl.org/xxx/rest/services/Web_Map_GP_Services/ZipTest/GPServer/uploads/upload",
form: dojo.byId("uploadForm"),
content: {f: 'json'},
handleAs: 'json',
}).then(uploadSucceeded, uploadFailed);
}
function uploadSucceeded(response) {
var itemID = response["item"].itemID;
console.log("File upload successful, item ID: ", itemID);
var params = {"Input_Zip_File": "{'itemID':" +itemID+ "}" };
gp.submitJob(params, gpJobComplete, gpJobStatus, function(error){
console.log(error.jobStatus + '(' + error.jobId + '):' + dojo.toJson(error));
});
}
function gpJobComplete(result){
console.log(result.jobStatus + '(' + result.jobId + ')')
}
function gpJobStatus(result){
console.log(result.jobStatus + '(' + result.jobId + '):' + dojo.toJson(message));
}
function uploadFailed(response){
console.log("Failed: ", response);
}
});
{'url':'https://www.myurl.org/myfile.zip'}