Exposing an application as a service
Exposing an application as a service
The two most common ways to expose your application as a service are: to create a web service or to leverage the Pega API.
Conceptually, these two options work the same way: a request is made to a URL, and a response is returned. The difference is how you communicate with the service.
Leveraging the Pega API
The Pega API provides a standard set of services that includes new case creation, assignment processing, and access to data pages. These built-in REST/JSON services enable the rapid implementation of Pega-powered mobile and client applications.
You can call any of the Pega API services by using standard HTTP methods (for example, GET, POST, or PUT). Refer to the Pega API resources page in Dev Studio or App Studio to see details of the request and response data requirements.
Tip: In Dev Studio, click the Resources Pega API. In App Studio, click Interfaces > Pega API.
This documentation is also available in JSON format in the Docs API (GET/docs).
|Assignment API||Provides the ability to obtain a list of assignments for a user, obtain the details of any specific assignment, and perform an assignment action|
|Authenticate API||Allows you to verify user credentials|
|Cases API||Provides the ability to obtain a list of cases for a user, create a new case, obtain case details, and update a specific case|
|Casetypes API||Provides the ability to obtain a list of case types for the authenticated user|
|Data API||Facilitates the process of obtaining the contents of a data page and obtaining the metadata for a specific data page|
|Docs API||Provides access to the complete documentation for the Pega API|
You can learn more about the Pega API on Pega Community at Pega APIs and services.
Creating a SOAP service
When you have a requirement to implement a SOAP web service to expose your application to other applications, you do this by creating a service. SOAP web services communicate using the SOAP protocol and pass XML messages from one application to another. Your application needs to convert that XML message to Pega objects to process them and then convert those Pega objects back to XML after the processing is complete.
A SOAP service uses a combination of rules to process a request. The rules you use are:
|Service activity||Provides the processing for a service rule|
|XML Parser||Maps data from an XML message into clipboard property values|
|XML Stream||Assembles and sends an XML document in an email message, a SOAP message, a file, or other types of messages|
|Service Package||Groups one or more service rules that are designed to be developed, tested, and deployed together|
These rules work together to process a request and send a response back to another application. The following diagram shows how Pega processes a service request.
- A client application sends a request to your application.
- The service listener listens for incoming requests. This functionality is provided by either the Web Server, Application Server, or Pega Listener.
- The service listener receives the request and instantiates the Service API to provide communication with Pega. Then, the Service API hands control over to Pega.
- Pega looks up the service package and related service rule, using the access group specified in the service package.
- Pega then establishes the service requestor and optionally performs authentication based on security credentials that are passed in the request. Once authenticated, service processing continues using the authenticated user’s access group, not the access group that is contained in the service package.
- The request is mapped, using the instance of an XML Parser rule, onto the clipboard according to the specifications contained in the service rule.
- Control is passed to the service activity, which provides the logic for the service.
- The service rule maps the clipboard data to form the response data, using the XML Stream rule.
- The service listener receives the response from the Service API.
- The service listener sends the response back to the application that made the request.
- The client application receives the request.
Note: Both service package and service listeners perform authentication. The authentication that you define on the service listener helps connect Pega Platform to an external source. The authentication that you define on the service package helps to connect an external source to the Pega Platform.