Question

Javascript Rest example keeps sessionID

  • 9 November 2017
  • 5 replies
  • 3 views

Userlevel 1
Badge +18

I was experimenting with this example:

https://playground.fmeserver.com/javascript/server-uploads/upload-file-drag-drop/

My problem is that the sessionID doesn't change. So if I upload multiple times all those files are processed. (I don't want that) I have to either change the sessionID or remove the files before uploading new ones. Any advice on this?


5 replies

Badge

Hi @stalknecht,

the session ID of the data upload service allows you to upload more than one file at once to be processed by a workspace. This is particularly important for formats that consist of several files like the SHAPE file, for example.

 

Looking at the simple example snippet on the Playground I would recommend to reset the session after every data download job. This way you don't need to remove any files. This can be easily done by getting a new session right after the function 'FMEServer.runWorkspaceWithData' was called. Here is an example of how this could look like in the 'runWorkspace' function of the Upload file example you mentioned:

If you are looking for a more robust drag & drop upload example for a FME Server workspace with some extended functionality make sure to check out this Demo:

 

http://demos.fmeserver.com/easytranslator/index.html

Let us know if this helps!

Userlevel 1
Badge +18

Hi @stalknecht,

the session ID of the data upload service allows you to upload more than one file at once to be processed by a workspace. This is particularly important for formats that consist of several files like the SHAPE file, for example.

 

Looking at the simple example snippet on the Playground I would recommend to reset the session after every data download job. This way you don't need to remove any files. This can be easily done by getting a new session right after the function 'FMEServer.runWorkspaceWithData' was called. Here is an example of how this could look like in the 'runWorkspace' function of the Upload file example you mentioned:

If you are looking for a more robust drag & drop upload example for a FME Server workspace with some extended functionality make sure to check out this Demo:

 

http://demos.fmeserver.com/easytranslator/index.html

Let us know if this helps!

Thanks, this helps.

 

 

Badge
Thanks, this helps.

 

 

I just updated this after another test. I think it's better to use 'FMEServer.getSession' function to reset the session ID in this example.

 

 

Userlevel 1
Badge +18
I just updated this after another test. I think it's better to use 'FMEServer.getSession' function to reset the session ID in this example.

 

 

Can you give me an example of that one. Just calling getSession didn't do the trick for me. The easytranslator demo works also in IE so I'm trying to implement this one.

 

Badge
Can you give me an example of that one. Just calling getSession didn't do the trick for me. The easytranslator demo works also in IE so I'm trying to implement this one.

 

Here is a quick example how to do this:

 

https://screencast.com/t/9INw1BSb

 

Reply