Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Map base64 encoded response returned by Connect-REST call



A Connect-REST call is made to a Web service that returns an XML response that is in base64 encoded format. The requirement is to map the base64 encoded response to the required response data model on the Pega application.

Error Messages

Not Applicable

Steps to Reproduce

Not Applicable

Root Cause

An issue in the custom application code or rules.


Follow the below example to map an XML response encoded in base64 format that is returned by a REST Web Service:
1. Create a Connect-REST Integration for GET Request using below Sample Response XML:

<?xml version="1.0" encoding="UTF-8"?>
   <animal type="birdType">
   <animal type="fishType">

The Base64 encoded string for the above Response XML is as below


2. Open the Connect-REST rule when the Connect-REST Integration wizard generates all the rules.
3. Navigate to the Response tab of the Get Method to map the response as a Clipboard string instead of the XML Parse rule.

4. Map the response to a string property as the endpoint returns the response in a base64 encode string format.

5. Create an activity in the Integration Layer to decode the base64 encoded Response message.
6. Use the Apply-Parse-XML method in the same activity to map the converted XML string to the Clipboard properties in the Integration Layer. The Parse-XML rule used in the activity is the same Parse XML rule which the Create-REST Integration wizard generated in Step 2.

7. Update the Response data transform which the Create-REST Integration wizard generated to invoke the activity created. In the first step of the Response data transform, the activity created in the Integration layer is invoked to decode the response to the XML Response message and map the XML to the Clipboard properties in the Integration Layer.

In the below example, the @pxExecuteAnActivity(DataSource,Animals) function invokes the 'Animals' activity that is created in the Integration Layer in Step 3.

Below is the result for the data page (D_Animals) execution: