How to Create and Update Outputs using the StrategyBlocks Web Services API

If you are already familiar with Web Services, then you can download a copy of the StrategyBlocks WSDL file and get straight into creating Outputs in StrategyBlocks, you can find the WSDL file here.

The StrategyBlocks Web Service currently supports 2 operations, they are:

  • Create/update a single Output.

  • Create/update a list of Outputs.

In the tutorial below, you will learn how to create a list of Outputs in an ETL tool called Talend using the StrategyBlocks Web Services API. We are using Talend because it is a free tool that everyone could use, you can use any ETL you prefer to create Outputs into StrategyBlocks, as long as it supports UsernameToken authentication.

Create/update a list of Outputs using Talend

  • Right-click Job Designs in the Repository tab

  • In the menu, click on Create Job to open the New Job Wizard

  • In the name field, name the job tutorial_upload_kpis

  • Click on Finish to close the wizard and create the job

  • Drag then drop a tEsbConsumer component from the Palette into the Job Designer

  • Double-click on the tEsbConsumer component

  • In the WSDL field of pop-up set the value to “https://app.strategyblocks.com/web-services/strategyblocks.wsdl”

  • Select updateKpis in the list of operations

  • Check the Populate schema to repository on Finish check-box option

  • Click on Ok

  • Go to the Component tab

  • Double-click on the tEsbConsumer component

  • Check the Use Authentication check-box option

  • Select the Username Token in the drop-down list and fill in your login credential fields

If you don’t have a StrategyBlocks login, then you can use the following credentials

  • Username: wsdl.user@strategyblocks.com

  • Password: secret

  • Drag and drop a tXMLMap component from the palette into the Job Designer

  • Right-click and drag the tXMLMap component over the tEsbConsumer component, then release.

  • In the pop-up name the output “xml” and click Ok

  • Double-click on the tXMLMap component

  • Right-click on the payload element in the right column of the pop-up

  • In the menu select the Import from Repository option

  • Locate and select the updateKpisRequest schema shown in the screenshot

  • Click Ok to populate the XML message with the updateKpisRequest schema

  • Drag and drop 2 tLogRow components into the Job Designer

  • Right-click on the tEsbConsumer component and select Row > Response and link it to one of the tLogRow components

  • Right-click on the tEsbConsumer component and select Row > Fault and link it to the other tLogRow component

  • Download the xml file containing a list of test Outputs at http://docs.strategyblocks.com/lib/exe/fetch.php/userguide/user/kpis.zip

  • Find File XML in the Repository Tab

  • Right-click on it and select Create File XML in the menu

  • Give it a name and click Next

  • Select the Input XML option and click Next

  • Locate the xml file containing the test Outputs and click Next

  • Drag and drop the kpi node from the Source Schema into the Xpath loop expression field

  • Drag and drop all the fields of the kpi node from the Source Schema into the Fields to extract

  • Click on the Refresh Preview button to preview the content of the xml file

  • Click Finish to create the metadata

  • Drag the newly created Outputs metadata from The Repository into the Job Designer

  • Right-click and drop the Outputs metadata onto the tXMLMap component

  • Double-click on the tXMLMap component

  • Drag and drop each of the metadata fields from the left panel into the corresponding XML message fields in the right panel

  • Make sure the XML message is complete like the screenshot

  • Click Apply, then Ok

  • Go to the Run tab

  • Click Run

  • If the Job has executed successfully, you will see the same log message as the one in the screenshot