Scenario 1: Using tESBConsumer - 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 Job that uses a tESBConsumer component to retrieve the valid email.

Dropping and linking the components

  1. Drop the following components from the Palette onto the design workspace: a tFixedFlowInput, a tESBConsumer, two tXMLMap, and two tLogRow components.

  2. Right-click the tFixedFlowInput component, select Row > Main from the contextual menu and click the first tXMLMap component.

  3. Right-click the tXMLMap component, select Row > *New Output* (Main) from the contextual menu and click the tESBConsumer component. Enter payload in the popup dialog box to name this row and accept the propagation that prompts you to get the schema from the tESBConsumer component.

  4. Right-click the tESBConsumer component, select Row > Response from the contextual menu and click the second tXMLMap component.

  5. Right-click the second tXMLMap component, select Row > *New Output* (Main) from the contextual menu and click the second tLogRow component. Enter response in the popup dialog box to name this row.

  6. Right-click the tESBConsumer component again, select Row > Fault from the contextual menu and click the other tLogRow component.

Configuring the components

Configuring the tESBConsumer component

In this scenario, a public web service which is available at http://www.webservicex.net/ValidateEmail.asmx will be called by the tESBConsumer component to returns true or false for an email address. You can view the WSDL definition of the service at http://www.webservicex.net/ValidateEmail.asmx?WSDL for the service description.

  1. In the design workspace, double-click the tESBConsumer component to open its Basic settings view in the Component tab.

  2. Click the three-dot button next to Service configuration.

  3. In the dialog box that appears, type in: http://www.webservicex.net/ValidateEmail.asmx?WSDL in the WSDL field and click the refresh button to retrieve port name and operation name. In the Port Name list, select the port you want to use, ValidateEmailSoap in this example.

    Select the Populate schema to repository on finish to retrieve the schema from the WSDL definition, which will be used by the tFixedFlowInput component. This option is only available to users of Talend Studio with ESB. If you don't have this option, please ignore it. The schema can be created manually in the tFixedFlowInput component, which will be shown later.

    Click Finish to validate your settings and close the dialog box.

  4. Click the Advanced settings view in the Component tab.

  5. Select the Log messages check box to show the exchange log in the execution console.

Configuring the tFixedFlowInput component

  1. Double-click the tFixedFlowInput component to open its Basic settings view in the Component tab.

  2. For users of Talend Studio with ESB who have retrieved the schema from the service WSDL definition in the configuration of the tESBConsumer component, select Repository from the Schema list. Then click the [...] of the next field to show the Repository Content dialog box. Select the metadata under the IsValidEmail node to use it as the schema of the input message. Click OK to close the dialog box.

    For users of Talend Studio without ESB, please go to the next step.

  3. For users of Talend Studio without ESB, the schema need to be created manually. Select Built-In from the Schema list.

    Click the three-dot button next to Edit Schema. In the schema dialog box, click the plus button to add a new line of String type and name it Email. Click OK to close the dialog box.

  4. In the Number of rows field, set the number of rows as 1.

  5. In the Mode area, select Use Single Table and input the following request in double quotation marks into the Value field:

    nomatter@gmail.com

Configuring the tXMLMap component in the input flow

Talend data integration uses schemas based on rows and columns since it has roots in relational data warehouse integration. But SOAP messages uses the XML format. XML is hierarchical and supports richer structure than rows or columns. So we need the tXMLMap to convert from the relational row/column structure to the schema expected by the SOAP service.

  1. In the design workspace, double-click the tXMLMap component to open the Map Editor.

  2. In the output table, right-click the root node and select Rename from the contextual menu. Enter IsValidEmail in the dialog box that appears.

  3. Right-click the IsValidEmail node and select Set A Namespace from the contextual menu. Enter http://www.webservicex.net in the dialog box that appears.

  4. Right-click the IsValidEmail node again and select Create Sub-Element from the contextual menu. Enter Email in the dialog box that appears.

  5. Right-click the Email node and select As loop element from the contextual menu.

  6. Click the Email node in the input table and drop it to the Expression column in the row of the Email node in the output table.

  7. Click OK to validate the mapping and close the Map Editor.

Configuring the tXMLMap component in the output flow

The tXMLMap in the output flow will convert the response message from the XML format to the row/column structure.

  1. In the design workspace, double-click the tXMLMap component in the output flow to open the Map Editor.

  2. In the input table, right-click the root node and select Rename from the contextual menu. Enter IsValidEmailResponse in the dialog box that appears.

  3. Right-click the IsValidEmailResponse node and select Set A Namespace from the contextual menu. Enter http://www.webservicex.net in the dialog box that appears.

  4. Right-click the IsValidEmailResponse node again and select Create Sub-Element from the contextual menu. Enter IsValidEmailResult in the dialog box that appears.

  5. Right-click the IsValidEmailResult node and select As loop element from the contextual menu.

  6. On the lower right part of the map editor , click [+] to add a row of String type to the output table and name it response.

  7. Click the IsValidEmailResult node in the input table and drop it to the Expression column in the row of the response node in the output table.

  8. Click OK to validate the mapping and close the Map Editor.

The tLogRow components will monitor the exchanges from the response and fault messages and does not need any configuration. Press Ctrl+S to save your Job.

Executing the Job

Click the Run view to display it and click the Run button to launch the execution of your Job. You can also press F6 to execute it. In the execution log you will see:

The email address nomatter@gmail.com is returned as false. The input and output SOAP messages in XML are also shown in the console.