2

Scenario:

Custom Export Service. The service creates zip files with shps in them and return the url to the file. I understand if you intend to to run this in synchronous mode, you must have a tool parameter with output type as "File" or the synchronous service will immediately delete the output zip file.

When testing, I noticed if my output parameter was instead set to "String" and the output content was a JSON object, async worked fine, but synchronous would not persist the output file on disk.

Question:

From a synchronous gp service, How can I return an arbitrary number of urls to output files on disk?

I'm wondering if this is impossible with current configuration options since output "File" parameters must be defined at publish time and cannot be altered at runtime. I could return a json object with all the paths, but only any paths defined in the tool will remain on disk after the service's response.

1

I Would get around this by creating a tool with 1 output file, and in your script as the final stage zip the arbitary number of files inside the output zip, and return to client.

  • This is the correct answer. Simply, GP Service doesn't support arbitrary number of outputs. Services need to be designed with expected inputs and outputs. This is the contract a service offers to the client consuming it. Having a variable number of outputs breaks that contract and expects the client to understand and be able to handle multiple outputs. (I've answer this in another question somewhere, but I can't find it) – KHibma Nov 1 '18 at 13:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.