Studio comes with the option to generate activities directly from SOAP or REST web services through the Service Editor window.
The window enables you to automatically load all the methods or endpoints in a given web service, be it REST or SOAP, as long as the provided link includes the services' definition - Swagger or WSDL.
Once loaded you select from which endpoints or methods to automatically create activities. All selected items are displayed in the Activities panel, under the Namespace you provided in the Service Editor window.
It is possible to then package these libraries as a .nupkg
file and publish it to Orchestrator or to a custom location. As a result, you can easily share your newly-defined activity with other developers that you work with.
Adding New Services
Follow the steps below to generate activities from web services:
- Create a library in Studio, as explained in the About Libraries page.
- In the Design tab, click New Service, or right-click Services in the Project panel, then click New Service. The Service Editor window is displayed.
- Add a file path or link to the Swagger or WSDL resource and then click Load. All defined endpoints from the web service are now loaded in the Service Editor window.
- Type in the method or operation you need in the Search Operations search box and view the results below. For Swagger, methods are marked with different colors in each endpoint. Use the Deselect All checkbox to deselects all endpoints and choose the endpoints that you want to load. The namespace is generated automatically, simply type in a new name to change it.
- Click Save. The service is now integrated in the project tree.
- To use the generated activities in the Designer panel, go to the Activities panel, search by the service namespace in the Available activities section and drag each activity to the panel.
Note:
For SOAP services, it is recommended to load only SOAP clients, as opposed to
HttpGet
orHttpPost
clients.
For Swagger services, when the service cannot deserialize the response from the server, it is recommended to inspect the Swagger schema and search for required properties in the model definitions.
To edit a service simply right-click the service in the Project panel, under Services and select Edit Service.
Please note that if your project is under source control, checking out only the library's project.json
file enables the Edit Services option for .xaml
files with loaded SOAP or REST web services.
Adding and editing a service is also reflected in the project.json
file containing the definition of the library, and in the service document. A webServices
node is added in the project.json
file, and each service is identified by the following elements:
Parameter | Description |
---|---|
namespace | The name of the service provided in the Service Editor window. |
serviceDocument | The path to the .json file containing metadata for the SOAP or Swagger service. The file is used when the service is repaired, and should be versioned as part of the project. |
webDocumentUri | The file path or link to the Swagger or SOAP resource (provided when the service is created in the Service Editor window). |
uniqueReference | A reference needed for versioning the service. |
Repairing Services
dll
files generated from SOAP or REST web services are not pushed to source control repositories. Therefore, when checking out libraries that contain services, the projects have unresolved activities in the Designer panel.
To repair those activities and generate the service .dll
file right-click on the service node in the Project panel and select Repair Service from the context menu.
SOAP or REST service metadata and additional information is stored in a .json
file for each service loaded in Studio. If a loaded service is missing its associated .json
file, the Repair Services context menu option for the Services node enables you to generate the missing .json
files using the link to the web document descriptor that was provided when that service was created. As a consequence, filters that might have been applied when the service was first generated are not applied anymore and all the resources provided by the aforementioned path or link are imported.
Publishing libraries using UiPath.Studio.CommandLine.exe
command-line user interface detailed in the Mass Update Command Line Parameters page does not take web services into consideration.
Note:
Generated activities from SOAP or REST services cannot be localized in Studio.
To call activities generated from web services multiple times inside a loop, create a separate workflow from the main library file, and invoke the service method there. In the main workflow, use the Invoke Workflow File activity inside a For Each activity, and invoke the previously created workflow.
For more details about generated activities from web services, check out this page.
Updated 3 years ago