Scenario: Getting country names through a Web service - 6.1

Talend Components Reference Guide

EnrichVersion
6.1
EnrichProdName
Talend Big Data
Talend Big Data Platform
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for Big Data
Talend Open Studio for Data Integration
Talend Open Studio for Data Quality
Talend Open Studio for ESB
Talend Open Studio for MDM
Talend Real-Time Big Data Platform
task
Data Governance
Data Quality and Preparation
Design and Development
EnrichPlatform
Talend Studio

This scenario describes a three-component Job that uses a Web service to retrieve the country name corresponding to a given country code.

Linking components

  1. Drop the following components from the Palette onto the design workspace: tFixedFlowInput, tWebService, and tLogRow.

  2. Connect the components together using Main Row links.

Configuring the input data

  1. Double-click tFixedFlowInput to open its Basic settings view and define the component properties.

  2. Click the three-dot button next to the Edit schema field to open a dialog box where you can define the input schema.

  3. In the open dialog box, click the plus button to add a column to the schema.

  4. Click in the column and type in a name, CountryCode in this example.

  5. Click OK to close the schema definition dialog box. The CountryCode column displays in the Values table in the component Basic settings view.

  6. In the Values table, click in the Value column and enter the value of the CountryCode column, cn in this example. This country code will be passed to the tWebService component to retrieve the country name corresponding to it.

Configuring the Web service

Selecting the WSDL

  1. Double-click tWebService to open the component editor, or select the component in the design workspace and in the Basic settings view, click the three-dot button next to Service configuration.

  2. In the WSDL field, enter the Web service address or browse to it, if the WSDL is locally stored, by clicking the [Browse...] button. In this example, the WSDL URL is http://www.webservicex.net/ country.asmx?WSDL.

  3. Click the refresh button next to the WSDL filed to retrieve the WSDL description and display it in the fields that follow.

  4. In the Port Name list, select the port you want to use, countrySoap in this example.

  5. In the Operation list, select the service you want to use. In this example the selected service is GetCountryByCountryCode(parameters):string.

Configure the input mapping

  1. Click Next to open a new view in the editor.

  2. In the panel to the right of the Input mapping view, select [+] parameters and then click the plus button on top to display the [Parameter Tree] dialog box where you can select any of the listed parameters.

    The Web service in this example has only one input parameter, CountryCode.

    Note

    If available, use the Auto map! button, located at the bottom left of the interface, to carry out the mapping operation automatically.

    You now need to create a connection between the input schema and the input parameter of the defined Web service.

  3. In the Column list, drag the column in the input schema you want to link to the input parameter of the Web service to the corresponding parameter in the panel to the right.

Configuring the output mapping

  1. Click Next to open a new view in the editor.

    In the Element list to the left of the view, the output parameter of the web service displays automatically. However, you can add other parameters if you select [+] parameters and then click the plus button on top to display the [Parameter Tree] dialog box where you can select any of the parameters listed.

    The Web service in this example has only one output parameter: GetCountryByCountryCodeResult.

  2. In the panel to the right of the view, click the three-dot button next to Edit Schema to open a dialog box in which you can define the output schema.

  3. In the Output list to the right of the dialog box, click the plus button to add a column to the output schema.

  4. Click in the column and type in a name, Result in this example. This will retrieve the names of the country.

  5. Click OK to validate your changes and to close the schema definition dialog box.

    You now need to create a connection between the output parameter of the defined Web service and the schema of the output component.

  6. In the Element list to the right of the editor, drag parameters.GetCountryByCountryCodeResult to the field that corresponds to the Result column to the right of the editor.

    Note

    If available, use the Auto map! button, located at the bottom left of the interface, to carry out the mapping operation automatically.

  7. Click OK to validate your changes and to close the editor.

  8. Click the [...] button to open the [Schema] dialog box, and add a column to the output schema, Result in this example. Then click OK to validate the schema setting and close the dialog box.

  9. Double-click the tLogRow component to open its Basic settings view, and click Sync columns to retrieve the schema from the proceeding component.

Executing the Job

  • Save your Job and press F6 to execute it.

The country name corresponding to the specified country code is returned from the Web service.