<< Click to Display Table of Contents >> Receiving files from a Web service |
The following example illustrates how to map information through the WS Connector, when you wish to receive files from a Web service and into Bizagi.
For more information refer to Sending and receiving files.
Receiving files from a Web service and into Bizagi
To illustrate how to configure integration with Web services, when files are sent in the Web service's response, we will use the Vehicle Insurance policy process as an example.
In this process, we create a new service task called Search for client record, which comes right after the vehicle insurance policy underwriting starts.
This service task is in charge of fetching the policy owner's record (which contains additional detail and a picture of the client) in an external system.
To configure the Web service invocation, we launch the WS Connector from the Step 6: Integrate (Define Integration Interfaces), and configure the service task with the following steps:
1. Enter the Web service main information
When entering the URL, click the Go button and select the Web method. Click Next.
2. Define the input parameters
Map the information coming from Bizagi which is sent to the Web service.
In this scenario we want to retrieve information of the insurance holder, and therefore we will send the client's document and document type.
3. Define the output parameters
Map the incoming response information from the Web service to the attributes in your processes data model (so that it is updated back in Bizagi).
For this example, our Web service will returns a file for the client's picture.
We map it to the data property of our Picture attribute of our process (data contains the file bytes).
Keep in mind that the Picture attribute is an Image attribute in our data model:
Notice that if you wish to have the file's name, then you should map into the fileName attribute as well. |
4. Define optional error handling
For this example, we do not need to configure error handling for a potential invocation failure.
Click Finish.
At this point we are done, and we may now execute the process!
Additional considerations
When mapping files incoming from a Web service, consider the following:
1. It is required that the Web service returns an array of bytes to Bizagi (byte []).
2. File type attributes in Bizagi can contain more than 1 file. Image file attributes on the other hand, are already restricted to a maximum of 1 uploaded file. For file type attributes, note that:
•You may choose to store more than 1 file in Bizagi, incoming from the Web service.
For this scenario, the Web service needs to send in its output parameters a collection of files (represented as an array of bytes array) and you will need to make sure that you map the collection item as well:
Execution
In Bizagi Work Portal, we may create a new instance for the Vehicle insurance policy underwriting process to invoke a Web service in which we receive files and store them in Bizagi.
We enter the document and select a document type for the policy holder:
When clicking on Next, the activity that follows the service task (where the Web service is invoked) will show the updated response.
Notice that the client was found at the external service, and its response sent the picture of that client (returned it into an image):
Last Updated 3/4/2022 1:56:18 PM