How to create a simple WSDL-first data services with Talend ESB Studio version 4.2 Learn how to create simple provider and consumer data services






This tutorial was made with Talend ESB Studio version 4.2 and can not be followed with the new 5.0 Talend Open Studio for ESB.

But new 5.0 tutorials have been created! For a tutorial showing how to create a service with Talend Open Studio for ESB 5.0, click here.


In this tutorial, you will see how to build your first simple WSDL-first data service in both Talend ESB Studio Standard and Enterprise Edition by using Talend ESB components and the new tXMLMap component.

We will connect to an airport Web Service via a WSDL file provided to us, send a request (here, we are sending country codes) to this Web Service and retrieve the response from the Web Service. To do so, we need to create two data service jobs:

- The provider job that will give access to the Web Service via a WSDL, to send a request and retrieve the response.
- The consumer job that will send data to request that same Web Service.

Prerequisite:
To follow this tutorial, you need to extract and import the airport_soap.wsdl file from the exampleFile.zip file available for download in the Download it! section of this tutorial.

Download it!

You want to practice?

Download exampleFile.zip to get the files used for this tutorial.

You can also download tutorialProject.zip containing all the jobs needed to carry out this tutorial.

You can also:
Send it!

Share it!
Next Step: Learn [How to export and deploy data services into Talend ESB Container version 4.2] or [How to use Service Activity Monitoring and Service Locator of Talend ESB 4.2 ]

 


Create a provider data service job design


In the Repository to the left of the Talend ESB Studio main screen:

Right-click Job Designs.

In the menu, click Create Job to open the New Job wizard.

Next
In the New Job wizard:

In the Name field, name the job SimpleProvider.

Click Finish to close the wizard and create the job.

The Job Designer opens an empty job.

Next


In the Name field, accents, special characters and spaces are invalid. Also, do not use numbers to start the field.
In the Palette to the right:

To add the data service components, click the ESB family.

Click the tESBProviderRequest component and drop it onto the Job Designer, to the left of the canvas.

Next
On the same ESB family, click the tESBProviderResponse component and drop it onto the Job Designer, to the right of the canvas.

Next
To display the response sent by tESBProviderRequest on the console, you can add a tLogRow component. To do so:

Click the Logs & Errors family on the Palette.

Click the tLogRow component and drop it onto the Job Designer between the two ESB components.

Next
On the Job Designer:

To link the components together, right-click tESBProviderRequest, hold and drag it to tLogRow.

Follow the same procedure to link tLogRow to tESBProviderResponse.

Next
On the Job Designer:

Click tESBProviderRequest to select it and click the Component view at the bottom of the studio to display its properties.

Click [...] next to the Service configuration field to open the component's editor.

Note: you can also simply double-click tESBProviderRequest on the Job Designer and its editor will open.

Next
In tESBProviderRequest editor:

Click Browse... and select the WSDL you downloaded from the Download it! section of this tutorial. The WSDL field is filled in with the path to the WSDL file.

In the Port Name field, select airportSoap.

In the Operation field, select getAirportInformationByISOCountryCode.

Click OK to validate the configuration.

Next
Back to the Component view of tESBProvider:

Select the Keep Listening check box to ensure that the provider will continue listening for requests after processing the first incoming request.

Next
In the Job Designer:

Press F6 to run the job.
The job is automatically saved before being executed.

The Run view displays at the bottom of the studio and the console follows the execution. We can see that the Web Service from the WSDL has been published to the following endpoint: http://localhost:8200/esb/AirportService.

The Job is started and waits for requests.

Next
Create a consumer data service job design


In the Repository:

Right-click Job Designs and click Create Job in the menu to open the New Job wizard.

In the New Job wizard:

In the Name field, name the job SimpleConsumer and click Finish to close the wizard and create the job.

Next
In the Palette to the right:

To add an input component that will send a country code request to the tESBConsumer component, click the Misc family.

Click the tFixedFlowInput component and drop it onto the Job Designer, to the left of the canvas.

Next
In the Palette:

Click the Processing family.

Click the tXMLMap component and drop it onto the Job Designer next to tFixedFlowInput.

tXMLMap will transform the string data (the country code) inputted to XML data, as ESB components expect XML data as input.

Next
In the Palette:

To add the ESB component that will request the corresponding Web Service, click the ESB Family.

Click the tESBConsumer component and drop it onto the Job Designer next to tXMLMap.

Next
To display the result of the request in the console, add two tLogRow components: one for the responses and one for the rejects.

In the Palette:

Click the Logs & Errors family.

Click tLogRow and drop it onto the Job Designer. Repeat this step to add the second tLogRow.

Next
On the Job Designer:

To link the components together, right-click tFixedFlowInput, hold and drag to tXMLMap.

Follow the same procedure to link tXMLMap to tESBConsumer and name the output link request_XML when asked by the tXMLMap Output pop-up.

To link the consumer to the two tLogRow components:
- Right-click tESBConsumer, select Row > Response in the menu and click the top tLogRow.
- Right-click tESBConsumer, select Row > Fault in the menu and click the bottom tLogRow.

Next
Now we will set the properties of the components.

On the Job Designer:

Double-click the tFixedFlowInput component to display its corresponding Component view and set its properties.

In the Component view:

Click [...] next to the Edit schema field to define the schema of the component.

Next
In the Schema of tFixedFlowInput wizard:

Click the [+] button once to add a new column to the schema.

Rename this column countryCode and leave its Type as String.

Click OK to validate.

Next
Back to the Component view of tFixedFlowInput:

Note: the schema you just defined is automatically propagated to the different Mode area options.

Select the Use Inline Table option in the Mode area.

Click twice the [+] button to add two lines in the table and rename them FR and DE between double quotes.

Next
On the Job Designer:

Click tXMLMap to select it and click the Component view at the bottom of the studio to display its properties.

Click [...] next to the Map Editor field to open the component's editor.

Note: you can also simply double-click tXMLMap on the Job Designer and its editor will open.

Next
In the tXMLMap editor:

Right-click the default root node of the request_XML output table.

Click Create Sub-Element in the menu to open the Create New Element wizard.

Next
In the Create New Element wizard:

Name the element code as you input country codes through the tFixedFlowInput component.

And click OK.

Next
Back to the tXMLMap editor:

Right-click the newly created code node in the request_XML table and select As loop element in the menu.

Note: the loop element is mandatory and defines the XML element on which the iteration will be performed when receiving several requests.

Next
Now drop the countryCode column from the row1 input table to the code node of the request_XML output table.

Click Apply to apply the changes and OK to validate.

Next
On the Job Designer:

Click tESBConsumer to select it and click the Component view at the bottom of the studio to display its properties.

Click [...] next to Service configuration to open the component's editor.

Note: you can also simply double-click tESBConsumer on the Job Designer and its editor will open.

Next
In tESBConsumer editor:

Click Browse... and select the WSDL you downloaded from the Download it! section of this tutorial. The WSDL field is filled in with the path to the WSDL file.

In the Port Name field, select airportSoap.

In the Operation field, select getAirportInformationByISOCountryCode.

Click OK to validate the configuration.

Next
In the Job Designer:

Press F6 to run the job.
The job is automatically saved before being executed.

The Run view displays at the bottom of the studio and the console follows the execution. We can see that the two country codes have been transformed into XML and sent to the consumer.

Next
And if you have a look at the SimpleProvider job, you can see that the two requests sent to the consumer also requested the provider.

Note: the provider is still listening for request, so if you want to stop it, you will have to click the Kill button of the Run view.


 

    Download it!     Send it!     Share it!

You want to practice?

Download exampleFile.zip to get the files used for this tutorial.

You can also download tutorialProject.zip containing all the jobs needed to carry out this tutorial.

Friends / colleagues may be interested in this tutorial? Send it to them!

You liked this tutorial ? Support it!

[ top ]