Executing the invocation
IntroductionIn this example scenario, we are going to use GenericWS to extract data from Redmine, an open-source, flexible project management web application, using REST.
Setting up the DatabaseTo set up GenericWS for it to be ready for processing Redmine data, we have to configure some files, and create an additional database to parse the data through and receive the outputted data. First things first: We need to set up a new database to use for this example. I will be using GenWStest as example. Be sure that the database contains 2 tables; RedmineIssuesQuery and RedmineIssuesResults. These will be used by GenericWS to process the Redmine input and output data. The RedmineIssuesQuery only needs a RowID column with the datatype int and the value "1". (see figure 1)
The RedmineIssuesResults needs to have a SourceID column with the int datatype. The other columns will be generated by GenericWS. Figure 2 shows the design configuration of RedmineIssuesResults.
After you've created the database and tables with the correct columns and datatypes, it's time to add the database connection to GenericWS. This is done by adding a .xml file to \S4M_DM\DMESB\Data\DbConnection\ with the name of your database. In this .xml file, paste the following text. Take note: You need to edit the information to your own needs (Filename, name, ID, data source, initial catalog, uid and password) for it to work with your environment. To generate an ID, you can use GuidGen.
Once you've created the .xml file, be sure to restart the services.
<?xml version="1.0" encoding="utf-8"?> <DbConnection Name="GenWStest" ID="6bc99af5-27ea-4963-9f43-c7424e4e919e" Type="MSSQL" ConnectionString="data source=S4MTST-MIXED-20;initial catalog=GenWStest;Uid=;Pwd=" />
Invocation OptionsIt's time to configure GenericWS. In GenericWS, create a new Rest Invocation. You can give this Invocation any name you want, I will be using RedmineImport as an example. In the options tab, the only thing you'll need to configure is the URL parameter. The value for this parameter must be the .xml where you want to import data from, so in this case we enter http://www.redmine.org/issues.xml (see Figure 3)
In the Processing tab, we need to configure some more parameters. As seen in Figure 4, we have to define the Input Table, Output Table, Node/attribute to extract, and the resulttype. Because we have configured our Output table (RedmineIssuesResults) to receive Multi-column data, we can use the Multi-column result option. If your Processing tab looks like the one shown in Figure 4, with the correct values, you can proceed to the next step. Note: If you can't see anything in the DB connection tree, be sure that you've configured the DBconnection .xml correctly, and that you have restarted the services.
Executing the invocationYou can execute the invocation in 2 different ways:
- Use the Execute button on the Processing tab;
- Use an ESB workflow.
Now we're done with the Trigger, we can go ahead and configure the OIP_Action block. With this block we execute the GenericWS Invocation, and thus pull the data from Redmine. You want to configure this block with the GenericWSExecute service. The agent parameter can be set to OIP_Default, and the WS Action must be set to the Invocation you've created in GenericWS, RedmineImport in this case.
Executing the workflowNow everything is configured correctly, it's time to execute the workflow and see if the database table has retrieved the data from Redmine. You can start the workflow by clicking on the Source, select the Workflow tab and click the "Run" button. Once the workflow has been completed (see Figure 7), you can see that the list from Redmine has been outputted to the defined database(see Figure 8).
Take note: The output data may differ from the data shown in Figure 8, this is because Redmine is dynamic and it's data will change over time.