Skip to main content
Solved

How do I get FME Server to use "DataStreaming" instead "DataDownload" when sending response to Javascript (FMEerver.js) request?


agelfert
Contributor
Forum|alt.badge.img+8

It's quite possible I'm missing something rather obvious here. But I can't figure it out. Funny how when searching the web what I stumble upon is my own post from a year ago.

 

What I have put together since is a workspace that reads CSV and spits out JSON. I've published this to FME Server (2020.2) and selected "Data Streaming" and "Job Submitter" as services.

 

Now, I'm sending a CSV file from a web page to FME Server using some of the examples here, and effectively calling the workspace with a Javascript line like this:

FMEServer.runWorkspaceWithData( repository, workspace, params, callbackFunction);

This works great but all I've been able to do is hit the Download Service, so the service response contains a URL for a zip file. How do I switch this to Data Streaming ? I guess this might also turn this into a asynchronous? If so, is "runWorkspaceWithData" still the right way to do this?

Currently my params look like this:

var params = {
	filename : fileObj.name,
	files : [fileObj],
	params : [],
} 

I've seen some example that contained a property "service" in the params. Is that a way to select "Data Streaming".

 

Sorry, the FME Javascript pages were a great help until I got to this point. Any feedback is appreciated.

 

Best answer by david_r

The different services are referenced by using different service endpoints.

Try setting params.service to 'fmedatastreaming'. If the value is not specified, as in the example above, it defaults to 'fmedatadownload'.

Example:

var params = {
    	filename : fileObj.name,
    	files : [fileObj],
    	params: [],
    	service: 'fmedatastreaming'
    }

You can also look at the full source code for FMEServer.js here: http://api.fmeserver.com/js/v3/FMEServer.js

View original
Did this help you find an answer to your question?

2 replies

david_r
Celebrity
  • Best Answer
  • October 7, 2021

The different services are referenced by using different service endpoints.

Try setting params.service to 'fmedatastreaming'. If the value is not specified, as in the example above, it defaults to 'fmedatadownload'.

Example:

var params = {
    	filename : fileObj.name,
    	files : [fileObj],
    	params: [],
    	service: 'fmedatastreaming'
    }

You can also look at the full source code for FMEServer.js here: http://api.fmeserver.com/js/v3/FMEServer.js


agelfert
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • October 7, 2021

@david_r​  - that's perfect, thank you. I had tried the 'service' parameter earlier (see my post) but I was using the wrong keyword. So 'fmedatastreaming' fixed it. Works like charm now. Gonna be a good day today! 😁


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings