Invoking REST Services Example Flow Chart
This example illustrates how to invoke a REST service on a remote system using Flux. The Rest Action has only one required property: baseURL, which specifies the location of the HTTP service to invoke. Arguments can be passed to the REST service and the REST service can also return values which can be used in the flow chart.
The above screenshot illustrates a Rest Action which invokes the Yahoo StockQuote service at http://finance.yahoo.com/d/quotes.csv. The service takes two arguments: 1. quotes string argument, “GOOG+YHOO+HPQ+IBM+MSFT+ORCL”, and 2. format string argument "snl1d1t1ohgdr", which are passed to the REST service.
The result returned from the REST service is of type RestAction.RestActionResult. The Rest Action postscript maps result.result to a flow context variable "quote".
Variable substitution is used in the Console Action to display the value of the quote flow context variable.
Running this Example
To get started, first run the Flux Designer. You can start the Designer by clicking here, accessing the Flux program group from the Windows Start Menu, or manually executing flux-designer.bat (Windows) or flux-designer.sh (Unix).
Once you have the Flux Designer running, open the project that is located within the same directory as this example resides in, “/examples/end_users/rest_services”. To open the project, click the,, icon, browse to the previously mentioned directory and open the “fluxproject.fpr” file.
Starting a Flux Engine
Next, you will need to start a Flux engine. To start an engine, simply click the following blue highlighted hyperlink: Start Flux Engine. If your PDF viewer does not support hyperlink functionality, open the “start-unsecured-flux-engine” batch or shell file, depending on the platform you are running Flux with, located within your Flux installation directory. For Windows users, you can use the "Start unsecured engine" option within the start menu, under the Flux and Flux Engine tabs, to create and run a Flux engine.
Next, return to the Flux Designer and move your cursor over the “Flux Engines” tab located at the left of the screen.
Click the button at the top of the “Flux Engines” tab and the window shown below will appear.
Click on the “Advanced” tab at the top of the “Flux remote engine” window and click.
You should be back at the Flux main screen.
Look at the “Flux Engines” tab again. The engine you just started should look like the engine shown below.
Running the Example Flow Chart
Next, export your flow chart to the engine. You can do this step by clicking on the icon at the top right of the Flux main screen. You may also export a job by clicking on the “Export” menu at the top of the screen and selecting “Export to remote job scheduler engine”.
Another way to export your job is by right-clicking on your drawing canvas and selecting the “Export to remote job scheduler engine” option. The menu and option are shown below.
Click in the window represented below.
A confirmation window, illustrated below, will appear if the job was successfully exported. Click the button on the confirmation message. If there is an error message, contact email@example.com for assistance.
The example will display output on the Flux engine console, similar to the screen shown below.
Once this example is completed, you can shutdown your server by clicking the following hyperlink: Dispose the Flux engine. If your PDF viewer does not support this hyperlink functionality, locate and run the “shut-down-unsecured-flux-engine” batch or shell file within your Flux installation directory, depending upon which platform you are running Flux on.
The Rest Action is especially useful when integrating Flux with systems that are not Java based. You can use Flux to communicate with these systems easily using the Rest Action.