Warning
This component is relevant only when used with one of the Talend solutions with ESB, as it should be used with the
Service Repository node and the Data Service creation related
wizard(s).
Component family |
ESB/Web Services |
|
Function |
Serves a Talend Job cycle result as a Fault message of the Web |
|
Purpose |
Acts as Fault message of the Web Service response at the end of a |
|
Basic settings |
Schema and Edit schema |
A schema is a row description. It defines the number of fields to be processed and passed on Click Edit schema to make changes to the schema. If the
Click Sync columns to retrieve |
|
|
Built-in: The schema is created |
|
|
Repository: The schema already |
|
EBS service settings |
Fault title: Value of the NoteThe Row > Fault flow of tESBConsumer has a pre-defined schema whose |
Advanced settings |
tStatCatcher Statistics |
Select this check box to gather the Job processing metadata at a |
Global Variables |
NB_LINE: the number of rows processed. This is an After ERROR_MESSAGE: the error message generated by the A Flow variable functions during the execution of a component while an After variable To fill up a field or expression with a variable, press Ctrl + For further information about variables, see Talend Studio |
|
Usage |
This component should only be used with the tESBProviderRequest component. |
|
Limitation |
A JDK is required for this component to operate. |
This scenario involves two Jobs, one as the data service provider and the other as
data service consumer. The former listens to the requests from the consumer via
tESBProviderRequest, matches the country code
wrapped in the request against a MySQL database table that has the country code/airport
pairs via tMap, and finally returns the correct airport
name via tESBProviderResponse or if no matches are
found, the error message via tESBProviderFault. The
Consumer sends requests to the Provider and receives the airport information or error
reminders via tESBConsumer.
The data service airport has already been
defined under the Services node of the Repository tree view. Its schema has three major elements
as shown below:
For how to define a service in the Studio, see Talend Studio User
Guide.
-
Right-click getAirportInformationByISOCountryCode under the Web
service airport and from the
contextual menu, select Assign Job. -
In the [Operation Choice] window,
select Create a new Job and Assign it to this
Service Operation. -
Click Next to open the Job
description window. The Job name airportSoap_getAirportInformationByISOCountryCode is
automatically filled in. -
Click Finish to create the Job and
open it in the workspace. Three components are already available.
-
Drop tXMLMap and tMysqlInput from the Palette to the workspace.
-
Link tESBProviderRequest to tXMLMap using a Row > Main
connection. -
Link tMysqlInput to tXMLMap using a Row > Main
connection. -
Link tXMLMap to tESBProviderResponse using a Row > *New
Output*(Main) connection.In the new Output name pop-up window,
enter the output table name, airport_response.Click OK in the pop-up window that
asks whether to get the schema of the target component. -
Link tXMLMap to tESBProviderFault using a Row > *New
Output*(Main) connection.In the new Output name pop-up window,
enter the output table name, fault_message.Click OK in the pop-up window that
asks whether to get the schema of the target component.
-
Double-click tMysqlInput to display
its Basic settings view. -
Fill up the basic settings for the Mysql connection and database
table.Click the […] button to open the
schema editor. -
Click the [+] button to add two
columns, id and name, with the type of string.Click OK to close the editor.
Click Guess Query to retrieve the SQL
query. -
Double-click tXMLMap to open its
mapper. -
In the main : row1 table of the input
flow side (left), right-click the column name payload and from the contextual menu, select Import from Repository. Then the [Metadata] wizard is opened.Select the schema of the request message and click OK to validate this selection. In this
example, the schema is getAirportInformationByISOCountryCode. -
Do the same to import the hierarchical schemas for the response/fault
messages (right). In this example, these schemas are getAirportInformationByISOCountryCodeResponse and
getAirportInformationByISOCountryCodeFault
respectively. -
Then to create the join to the lookup data, drop the CountryAbbrviation node from the main flow
onto the id column of the lookup
flow. -
On the lookup flow table, click the wrench icon on the upper right
corner to open the setting panel.Set Lookup Model as Reload at each row, Match Model as All
matches and Join Model
as Inner join. -
On the airport_response output flow
table, click the wrench icon on the upper right corner to open the
setting panel.Set the All in one option as
true. This ensures that only one
response is returned for each request if multiple airport matches are
found in the database. -
On the fault_message output flow
table, click the wrench icon on the upper right corner to open the
setting panel.Set the Catch Lookup Inner Join
Reject option as true to
monitor the mismatches between the country code in the request and the
records in the database table. Once such a situation occurs, a fault
message will be generated by tESBConsumer and outputted via its Row > Fault
flow.Note
The Row > Fault flow of tESBConsumer has a predefined schema in which the
faultString column is filled
with the content of the field Fault
title of tESBProviderFault. -
Drop the name column in the lookup
flow onto the Expression area next to
the tns:getAirportInformationByISOCountryCodeResult node in
the airport_response output flow.Drop the tns:CountryAbbreviation
node in the main flow onto the Expression area next to the tns:getAirportInformationByISOCountryCodeFaultString
node in the fault_message output
flow. This way, the incorrect country code in the request will be shown
in the faultDetail column of the
Row > Fault flow of tESBConsumer.Click OK to close the editor and
validate this configuration. -
Double-click tESBProviderFault to
display its Basic settings view: -
In the field Fault title, enter the
context variable context.fault_message.For how to define context variables, see Talend Studio User Guide.
-
Press Ctrl +S to save the Job.
-
Press F6 to run this Job.
The data service is published and will listen to all the requests until you
click the Kill button to stop it as by default,
the Keep listening option of tESBProviderRequest is selected automatically.
Now is the time to configure the consumer Job that interacts with the data
service.
Built upon tESBConsumer, the consumer Job sends
two requests that contain the country codes to the Web service for the relevant
airport names. If wrong country code is wrapped in the request, the error message
will be returned. The country codes and the MySQL database records are as
follows:
-
Drop a tFileInputDelimited, a
tXMLMap, a tESBConsumer and two tLogRow from the Palette to the workspace. -
Rename one tLogRow as response and the other as fault_message.
-
Link tFileInputDelimited to tXMLMap using a Row > Main
connection. -
Link tXMLMap to tESBConsumer using a Row > *New
Output*(Main) connection.In the new Output name pop-up window,
enter the output table name, for example request.Click OK in the pop-up window that
asks whether to get the schema of the target component. -
Link tESBConsumer to response using the Row > Response
connection. -
Link tESBConsumer to fault_message using the Row > Fault
connection.
-
Double-click tFileInputDelimited to
open its Basic settings view. -
In the File name/stream field, enter
the context variable for the file that has the country codes, context.filepath. -
Click the […] button to open the
schema editor. -
Click the [+] button to add a column,
country_code, for example, with
the type of string.Click OK to close the editor.
-
Double-click tXMLMap to open its Map
editor. -
In the request table of the output
flow side, right-click the column name payload and from the contextual menu, select Import from Repository. Then the [Metadata] wizard is opened.Select the schema of the request message and click OK to validate this selection. In this
example, the schema is getAirportInformationByISOCountryCode. -
Drop the country_code column in the
main flow onto the Expression area next
to the tns:CountryAbbreviation node
in the request output flow.Click OK to close the editor and
validate this configuration. -
Double-click tESBConsumer to open its
service configuration wizard: -
Click the Browse… button to select
the desired WSDL file. The Port name
and Operation are automatically filled
up once the WSDL file is selected.Click OK to close the wizard.
-
Double-click response to open its
Basic settings view: -
Select Vertical (each row is a key/value
list) and then Print
label for a better view of the results.Do the same to the other tLogRow,
fault_message.