Home
- Home
- Blog
Author :
Global TechHub
Introduction
In this article, we will show you how
to integration Restful Service for business process applications in IBM
Business Process Manager. In an effort to building a simple and efficient web
client, many companies are adopting the Representational State Transfer (REST)
architecture as an alternative to WSDL based web services. As a result, the
demand for integrating external systems through their REST APIs increases.
Overview
To use a REST service in Process
Designer, you discover the service and select the operations that you want to
use. Then, set the server that contains the configuration properties that are
required to invoke the service. An external service is generated containing the
operations that you selected in the discovered service and a reference to the
server that you selected. Business objects are also generated based on the
OpenAPI specification.
Service providers update their
services periodically, and you might want to rediscover the updated service so
that you can use it. When you discover a service, if an external service
discovered from the same file already exists in Process Designer, you can
either overwrite the existing service or create a new one. To get the updated
version of the REST service, replace the external service. If you have a
service task for the external service, their operations and data mappings are
preserved, unless the operation or data is not included in the new version. If
the server connection information is unchanged, you can keep the reference to
the server information.
Discover a REST service from a local
OpenAPI specification (formerly known as Swagger) and generate an external
service based on the discovered REST service. You can then use the external
service in a service flow to invoke the REST service.
We need to follow the below steps to
Integrate with Restful Service.
1.
Get the Swagger file from
External Service.
2.
Create a External
Service.
3.
Create a Service Flow.
4. Test the application
Get the Swagger file
from External Service
You must have a file with a valid
OpenAPI specification that is locally available on your computer. The OpenAPI
format can be either JSON or YAML. To verify that your OpenAPI specification is
valid, open the file in an OpenAPI editor or a Swagger editor.
You can download the YAML file from
download section.
Create a External
Service
Beside Services in the library navigation, click the plus sign (+). Select External Service.
In the New External Service page, choose Java,
REST or Web service and click on next.
Select Browse local files (Swagger) and browse to the file.
Enter the External Service name as ‘Customer Service’ and click on Next.
The discovered operations are listed.
In our case we have only two operations ‘createCustomerUsingPOST’
and ‘getCustomerUsingGET’ select
the operations that you want to include in the external service and click on Next.
Set the server that contains the
properties used to invoke the REST service. Either select an existing server,
or create a new one based on information in the OpenAPI specification. Click Finish.
Create a Service Flow
Beside Services in the library navigation, click the plus sign (+). Select Service Flow.
In the Service Flow editor, select a
Service task. In the Implementation tab for the service, select the external
Service which we have created in above step.
Select the operation name ‘getCustomerUsingGET from drop down.
Select the variables section and create input variable name as ‘customerId’ type Integer and output
variable name as ‘customer’ type ‘Customer’.
Select Diagram section and select Invoke
Restful service task à
select properties and select Data Mapping and map the variables as
shown below.
Test the application
We have implemented integration flow
now and ready for testing.
Click on Debug button at right
corner. Make sure in variables section you have selected default value for input
‘customerId.
Finally you can see response as shown
below.
Conclusion
We have learnt how to integrate a
restful service using Swagger file. But there are some limitations using this approach. Please find the Limitations in my other article. I hope this article
helpful for some of you, I will come up with more interesting articles soon.
Download
S. No
|
File Name
|
Size
|
Download
|
1
|
Integrate a Restful Service in IBM BPM.pdf
|
1.6 MB
|
|
2
|
BPM_Integration_App_V2_Restful
Integration.zip
|
10 MB
|
Comments
Post a Comment