span8
span4
span8
span4
Hi there!
I'm trying to use the javascript API for FME Server to let a user upload a shape file and get it processed.Since shape files exist out of more than one file i'm trying to upload those as a zip archive.
Uploading works perfectly fine.
Now i need to get my uploaded files with 'FMEServer.getDataUploads' to process them via 'FMEServer.runWorkspaceWithData'.The JSON answer object i get has no property 'file', it has only properties 'archive'.Thats the reason why runWorkspaceWithData gets an error - it builds the rest call together, the property 'file' is undefined so the call looks something like this:
"NetworkError: 422 Unprocessable Entity -
Can someone help?
Best regards from Stuttgart Germany
Marius Kolleck
Hey there, sorry for the late response!
For me the solution works, i inserted the parameter another way.I manipulated the original FMEServer.js file, there is a codeline setting the parameters for an ajax call and sending it.
getSession : function(repository, workspace, callback){ callback = callback || null;var url = buildURL('{{svr}}/fmedataupload/' + repository + '//www.baooytra.com/knowledge/' + workspace);var params = 'opt_extractarchive=true&opt_pathlevel=3&opt_fullpath=true& tm_priority=5&token=' + getConfig('token');ajax(url, callback, 'POST', params, 'application/x-www-form-urlencoded');
I also configured my job priority there.
Hi Marius,
I am trying to achieve the same result - to upload zipped shp and run some workspace.
Using your suggestion doesn't give any positive result.
params.append('opt_extractarchive', true);
In the debugger i still get a message that i do not have any file:
no element found fileUpload.fmw:1:1
Could you please let me know if your suggestion works for you?
There's a parameter, you can set for fileuploads, that forces zip files to be unzipped:
opt_extractarchive = true
This parameter can't be set in the FMEServer.js-method uploadData(), it hast to be sent with the HTTP POST or HTTP PUT request to fmedataupload service (in FMEServer.js).I think it's also possible to send this as a parameter in the getSession method.
I myself added following line to the FMEServer.js in the dataUpload method:
params.append('opt_extractarchive', true);
(In my case every uploaded zip shall be unzipped for processing).
我发现开发商playgrou fme服务器nd, there's an example how to upload files in a session.
http://playground.fmeserver.com/javascript/server-uploads/upload-file-in-session/
Even here the problem exists, the dropdown menu "Source Format" offers ESRI Shape, the answer from getDataUploads is similar to mine:
{ "serviceResponse": { "statusInfo": { "status": "success" }, "session": "54001B18670924F76B94CB5DF3B3DD80", "files": { "path": "", "folder": [ { "name": "" } ], "archive": [ { "size": 10038818, "name": "Webanwendung_LHS_VS.zip" } ] } } }
Trying to "Run Workspace With Data" says, that no file is uploaded if you try a zipped up Shape file.But since there is no posibility to select mulitple files there is no way to upload shape except as a zip.
I took two screenshots for better understanding:
The first one shows what the function getDataUploads returns, if a zip file has been uploaded,
the second one is the javascript function from the FMEServer.js file wich cycles through the 'files'-array searching for a property 'name'.
Zipfiles are all listed in the child node 'archive', so the for-each loop gets for the 'name' propertyundefined.
FME server data download sending empty emails2 Answers
Deleting output data in FME Server based on their age1 Answer
FME Server Send Email1 Answer
Missing keywords {workspace} and {repository} in job submitter email1 Answer
Why can't filecopy writer output be included in the DataDownload zip file?3 Answers
© 2019 Safe Software Inc |Legal