API stands for Application programming interface.
API integration is fashionable.
It is close to impossible to find a modern web application that doesn’t expose an API.
That’s fabulous news for integration but it leaves behind the backbone of IT infrastructure
today, the legacy applications that businesses rely on for day to day processes.
Using API integration, it allows a software or web applications to communicate with other
software in a programmatic way.
UiPath builds a bridge between the new and the old world by automating in the same script
web services and legacy applications.
So UiPath works both ways by extracting data one application and pass it to a web service
or, vise-versa retrieving data from a web service and automating the UI with it.
While you already know how UiPath automates user interface, I’ll show you today how
you can call a web service to get the weather information for a specific city.
A web service is the most common way to connect two applications or electronic devices over
the Internet.
The 2 most common type of web service we'll discuss is SOAP and REST
We will divide this video into two parts.
First, we will use SOAP, which stands for Simple Object Access Protocol.
Some of the websites that uses SOAP API are eBay and Salesforce.
SOAP uses xml files to transport data and REST usually uses JSON.
[Video: Design Menu, web API, click SOAP] Let me show you how it is done.
In the Design menu, click on Web API.
Select SOAP Client.
It will give you the SOAP Request wizard.
We can put in the link to the web service under "Service Description"
Let me open a sample website.
Here, I have a sample public SOAP service called GlobalWeather.
If I click on this link, it will show you the code of an XML file containing the web
service description.
Let's go back and let's copy the SOAP service link.
Then we go back to UiPath and paste the link here.
Once done, we can click on Get.
This will load the content of the XML file.
Now we have an option to select the "Contract" and "Method" that retrieves the data we want
to fetch.
[Video: Click GetCitiesByCountry] Selecting a method will automatically change
the required parameters as well.
So if we chose this method (GetCitiesByCountry) it gives CountryName.
[Video: Click GetWeather] Let's select GetWeather method which will
retrieve the current weather in the city we specified.
Let's Type in "New York" for the city and United States for the country.
Some SOAP requires authentication.
Since we're using a public service, let's leave it as none.
Let's click on "Invoke" to preview the result.
It successfully retrieve the data.
To save this Activity, let's click on "Generate Activity".
In our workflow, we a have a new activity called Soap Client.
Let's set it as a Start node and delete the blank activity.
Let's rename it to make it more readable.
(GetWeather)
Let's open the GetWeather Activity and let's review the properties of this Activity.
The EndPoint is the URL of the web service.
We also have specified the ContractName and Method to be generated.
If we click on the Parameters, we have the default values for the City and the Country
which we can replace by variables.
The output of this activity is produce through this variable, "Soapclient"
We can rename it.
Let's go to the variables panel and rename the variable here.
Let's say "SoapResult".
Then let's change the scope to "Main" so we can use it later globally.
Let's test the result by adding a WriteLine Activity.
Let's put in the variable for our SoapActivity which is "SoapResult"
Let's run it.
Great!
So here's the result which is currently an XML in a text format.
As you can see it captures all available content based on the specified parameters.
In UiPath, we can further customize the output by extracting specific data from an XML result.
To extract data from an XML file, we can use a special activity called Deserialize XML.
This activity converts text XML files in an XML Document that we can easily manipulate.
Let's use it in our workflow.
Let's open it and specify the XML string we wanted to convert.
We'll put in the output variable for the SOAP activity.
The output of the Deserialize activity is saved in this XML Document variable.
Let's rename it to "xmlDoc"
This data type will help us to easily extract and manipulate data contained in the XML tree
structure.
[Video: go back to main add writeline] Let's add a WriteLine Activity
To retrieve specific data in an XML document.
We can use this simple code:
xmlDoc.Element(
The xmlDoc is the output variable of the xml file we used in the previous activity.
Then we will enclose the specific elements we want to capture.
Let's go back to the XML result.
As you can see the structure of the XML file has the root element and
we have multiple child elements.
So we'll try to extract the Temperature.
So we can type in xmlDoc.Element("CurrentWeather") which is
the root element.
.Element("Temperature") which is the child element.
.Value which will capture the value inside the tag, and
.ToString which will convert the value to a basic string format.
That's it let's run it!
Perfect!
There's our output data!
You just learned how to use UiPath to extract data from a SOAP web service and captures
specific data from it.
This is a simple and non-intrusive automation yet a powerful solution in extracting data
and provide a seamless integration between web apps and services.
In the next video, I'm going to demonstrate another type of web service called REST.
Thanks for watching.