In this Quick tutorial you will learn about How to Exposing an application with a service in Pega 8
Exposing an Application as a Service:
The two most common ways to expose your application as a service.
- Create a web service
- Leverage the Pega API
Note: These two options work the same way: a request is made to the URL, and a response is returned. The difference is how you communicate with the service.
Leverage 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.
Click the Resources menu and select Pega API to see the details of the request and response data requirement.
This documentation is also available in JSON format in the Docs API (GET/docs).
Create a SOAP 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 convert those Pega objects back to XML after the processing is complete.
A SOAP service uses a combination of rules to process a request.
- Service activity : It provides the processing for a service rule
- XML Parser : It Maps data from an XML message into clipboard property values.
- XML Stream : It Assembles and sends an XML document in an email message, a SOAP message, a file, or other types of messages.
- Service Package : It Groups one or more service rules that are designed to be developed, tested, and deployed together.
The following diagram shows how Pega processes a service request.
- In Dev Studio, Select Configure > Integration > Services > Service Wizard
- Set the Service Purpose to Create and manage work, Set the Service Type to SOAP and click Next.
- Set Work Type (Case) and set Flow Type to pyStartCase
- Select Create Work and set the Organization and click next.
- Select Use XML for data mapping to allow for list structures in the reqeust.
- Set the Ruleset Name and Ruleset Version to the version in which you are working.
- From the Service Package Options drop-down list, select Configure a new service package, then click Next.
- Keep the default settings in the Configuration Data Records screen. Click Next.
Note: Requires authentication is selected by default. This means that you need to provide an operator and password when you call your service.
- The Review and Save screen displays the records that will be created by the wizard. Click Finish to create the records.
Add inherited properties:
- Open the CreateNewWorkResponse XML parse rule generated by the Wizard
- Click Add Element to add the required input parameter that was not available for selection in the Wizard.
- Double-click the new property to configure it.
- Enter a Node Name specify the Property to map the value.
Test the service:
- Open the service rule.
- Click Actions > Run to test the service rule.
- Select Supply SOAP request envelope to enter values for the test.
- Click Execute to test the service.
- Your response will vary based on what you are attempting to do. If there is an error, you see a SOAPFault exception produced.