Calling Public Web Service using Talend Open Studio

Calling Public Web Service using Talend Open Studio:

Environment:
Talend Open Studio for Data Integration Version: 6.3.1
Java Compiler: 1.7
OS: Windows 8

This article will walk through the following steps to consume Public Web service in talend :

1. Get the public WSDL which is ready to consume
2. Add Talend components to Designer
3. Update the properties for parameterised request
4. Get the response, parse it and print it in console

This article will not cover the installation and setup of Talend Open Studio. The assumption is talend already installed and is working correctly. For details on how to install and configure Talend Open Studio see this post.

In the previous post we saw how to connect to Amazon S3 and upload a file from local instance to S3 buckets. Then we downloaded the same file back to the local directory. Today we will see how to consume  public web service, for demonstration we need some WSDL file. If you will google you will find tens of web service freely available. I will be using below link to get the city names based on country.

“http://www.webservicex.net/globalweather.asmx?WSDL”
Copy paste the URL in your browser to see all the methods avaiable.

Create a new project as job_Call_Public_Webservice under Job Designs in repository explorer. Drag tFixedFlowInput, tFlowToIterate, tWebServiceInput, tExtractXMLField and tLogRow to the design workspace. Either you search them in the palette or start typing directly in the design workspace, a drop down will be popped up immediately. This is how it looks like in my studio. Pay attention to the connectors.

1

 

Now we will configure the properties of each component. We will pass “India” as the parameter to the request. To add the column name click on Edit Schema and add a field as shown below.

1_6

Now select Use Inline Radio Button and click on add button to provide input. Since we can provide multiple values, we will be using tFlowIterate to iterate each of the values.

1_1

 

Okay now lets set the properties for tWebServiceInput. First of all click on edit schema and add one field of String type. This will be used as output to next component.

3

Then provide the WSDL link and method name. Since we need one input use below substitution code to get the fixed value from previous component.

(String)globalMap.get("row1.countryName")

1_2

Next we will configure tExtractXMLField. In similar fashion like we did for previous step click on edit schema and two column to the right side.

4

Then set the properties as shown below.

1_4

We are almost done. In the tLogRow select the mode as table. Thats it.

Press F6 to build and execute the job. Here is the output from console. If you want you can write the same to Oracle table using tOracleOut component.

Starting job job_Call_Public_Webservice at 20:00 26/03/2017.

[statistics] connecting to socket on port 4035
[statistics] connected
.——————————+——————————-.
| tLogRow_1 |
|=—————————–+——————————=|
|Country |City |
|=—————————–+——————————=|
|British Indian Ocean Territory|Diego Garcia |
|India |Ahmadabad |
|India |Akola |
|India |Aurangabad Chikalthan Aerodrome|
|India |Bombay / Santacruz |
|India |Bilaspur |
|India |Bhuj-Rudramata |
|India |Belgaum / Sambra |
|India |Bhopal / Bairagarh |
|India |Bhaunagar |
|India |Goa / Dabolim Airport |
|India |Indore |
|India |Jabalpur |
|India |Khandwa |
|India |Kolhapur |
|India |Nagpur Sonegaon |
|India |Rajkot |
|India |Sholapur |
|India |Agartala |
|India |Siliguri |
|India |Bhubaneswar |
|India |Calcutta / Dum Dum |
|India |Car Nicobar |
|India |Gorakhpur |
|India |Gauhati |
|India |Gaya |
|India |Imphal Tulihal |
|India |Jharsuguda |
|India |Jamshedpur |
|India |North Lakhimpur |
|India |Dibrugarh / Mohanbari |
|India |Port Blair |
|India |Patna |
|India |M. O. Ranchi |
|India |Agra |
|India |Allahabad / Bamhrauli |
|India |Amritsar |
|India |Varanasi / Babatpur |
|India |Bareilly |
|India |Kanpur / Chakeri |
|India |New Delhi / Safdarjung |
|India |New Delhi / Palam |
|India |Gwalior |
|India |Hissar |
|India |Jhansi |
|India |Jodhpur |
|India |Jaipur / Sanganer |
|India |Kota Aerodrome |
|India |Lucknow / Amausi |
|India |Satna |
|India |Udaipur Dabok |
|India |Bellary |
|India |Vijayawada / Gannavaram |
|India |Coimbatore / Peelamedu |
|India |Cochin / Willingdon |
|India |Cuddapah |
|India |Hyderabad Airport |
|India |Madurai |
|India |Mangalore / Bajpe |
|India |Madras / Minambakkam |
|India |Tiruchchirapalli |
|India |Thiruvananthapuram |
|India |Vellore |
‘——————————+——————————-‘
[statistics] disconnected
Job job_Call_Public_Webservice ended at 20:00 26/03/2017. [exit code=0]

Thats it for today. Let me know if you face any issues.

Thank you!!!

2

About the author

Bhabani(http://dwteam.in) - Currently Bhabani is working as Sr Development Engineer at Harman International. He has good expertise on Oracle, Oracle Data Integrator, Pervasive Data Integrator, MSBI, Talend and Java. He is also contributing in ODI-OTN forum for last 5 years. He is from India. If you want to reach him then please visit contact us page. If you have any doubts or concerns on the above article, please put your question here. Dw Team will try to respond it as soon as possible. Also dont forget to provide your comments / suggestions / feedback for further improvement. Thanks for your time.

Similar Posts

Leave a reply

required*

Are you a human? *