In this section, the service operation is customized to match the scenario.
On the workspace, double-click tMysqlInput to open its
view in the Component
Configure the tMysqlInput to load the customer data
in a MySQL database. In the DB
version field, select the version of
your MySQL database. It is Mysql
5 in this example. Specify the
connection details in the relevant fields, including:
- the host name or IP address of your database server
- the listening port number
- the database name
- the user name and password for your database authentication
Set the Schema
as Built-In and click
Edit schema to
define the desired schema. The schema editor opens. Click
the [+] button to add
three rows of String
type and give the name id, Phone, Email to the columns. Click OK to close the schema
- In the Table Name field, type in the name of the database table, customers in this case.
- In the Query box, enter the query required to retrieve the desired columns from the table, id, Phone, Email in this example.
On the workspace, double-click tXMLMap to open its editor.
At this moment, the editor should look like:
- In the main row 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.
Expand the File
XML node in this wizard, select the
schema of the request side and click OK to validate this selection. In this
example, the schema is CustomerServiceOperationRequest.
- In the main row table of the output flow side (right), right-click the column name payload and from the contextual menu, select Import from Repository. In the Metadata wizard, select the schema CustomerServiceOperationResponse to import the hierarchical schema for the response.
- To create the join to the lookup data, click the id node in the main row of the input side (left), hold and drop it onto the Exp.key column of the lookup flow, corresponding to the id row.
On the table representing the lookup flow, click
the wrench icon on the up-right corner to open the settings
panel. Set Lookup Model
as Reload at each row,
Match Model as
All matches and
Join Model as
- On the output table (right), click the wrench icon on the up-right corner to open the settings panel and set the All in one option as true. Right-click the Email node and select As loop element in the context menu.
Click the Phone row in the lookup flow (left),
hold and drop it onto the Expression column corresponding to the
Phone node in
the XML tree view of the output flow. Do the same to map
Email from the
left side to the right side.
The tXMLMap editor should look like this:
- Click OK to close the editor and validate this configuration.
Now, the implementation of the CustomerServiceOperation is complete.