Integrations
Integrations
Integrations
1. Connect-File.
2. Connector activity.
What is Connect-File?
1. File system
Destination Path : Provides a directory path of the App server. This is the path
where you can see your file.
If File Exists : If a duplicate file name is already there in the directory path,
then
What is BOM?
Byte Order Mark. Whenever you save a notepad file, you may come across
 character at the start. These are useful to identify which byte order or
which encoding methods (UTF-8) are used. These will be used for decoding
purposes. Pega recommends enabling BOM, if CSV data are exported
to Excel.
Imagine a scenario where you need to update the same file again and again
with different Connect-File methods. Check Keep File Open to true to enable
this function. Remember to close the file on the final Connect-File method.
3. Error Handling
This is same for all connectors. Holds the status value and message in
property values. Leave it as-is.
After configuring, use Test connectivity button to validate the destination path
configuration.
Page |3
If some error comes, then please check if the destination path provided is a
valid directory in App server.
Write from HTML stream rule (Copy the HTML content to file).
Write from XML stream (Copy the XML to .xml file).
Write from eForm (Used to create a PDF file).
Write from work attachment (Used to move the work object attachment).
Write from clipboard (Copy the clipboard property containing data to
file).
Close file (Use this in last Connect-File method when keep file open is
true).
Scenario: Create a text file containing string “This is a test String” and place it
in C:\TMP directory in App server path.
-Use Operation mode as “Write from clipboard property” with parameter set
from step 2.
Step 3: Manually run the activity and check the App server path C:\TMP
1. Connect-File.
2. Connector Activity.
You may get a question “Where the file gets created? How the mapping from
data source is handled?”
Introduction
First of all, don’t think INTEGRATION is a difficult topic in PEGA. I would say
Integration is much easier than creating an activity rule 🙂
Pega makes it simple for developers. All you need to do is configure the
Integration rules. Pega takes care of the rest 🙂 Pega provides useful wizards
and guides the developers in creating Integration rules.
Let me start from the basics. Every BPM application needs some data to
process.
Okay fine. Now tell me, “To process any request, is it mandatory that all the
data should be available within Pega?”
No. That is not required. Data can be available in other application too.
Imagine you have opened a Chrome web browser. Hit Google map
application.
Page |6
http://maps.googleapis.com/maps/api/geocode/json?address=Chennai
You will get the raw response data. This is how the server sends the
response.
What is a protocol?
What is REST?
Imagine, there are two close friends from different countries – France & Spain.
Page |7
Spanish guy don’t know French as like French guy don’t understand
Spanish. So how will they communicate with each other? Yes, through some
common language like English.
JSON & XML are the most commonly used messaging formats.
There is no such condition like you should always use REST over SOAP.
External system needs to access the policy details stored in Pega system.
Let’s say the request is PolicyID and the response is in JSON format.
{“SampleResponse”:
“PolicyType”:”Home”,
“PhoneNumber”:”9999999999”
}}
In our example,
“PolicyType”:”Home”,
“PhoneNumber”:”9999999999”
}}
Specify the class as concrete class and it does not belong to a class group.
1. Service tab
2. Methods tab
Servicetab
Primary Page
Page Name – You will see the default page as ‘MyServicePage’. You can
keep it as such.
MyServicePage will contain the request properties. You can update those
properties using data transform.
Resource Properties
P a g e | 11
First, let us see the paths and query strings in the URL.
So, when you expose a new Service-REST, you can verify the URL in the
service package rule.
http://11.12.124.32:8080/<ServicePackageName>/ServiceClassName/Service
MethodName
Protocol://<HostName>:<PortName>/<Package>/<Class>/<Method>
For example, if you wish that the URL should contain two more resource
paths, then
http://host:port/<ServicePackageName>/ServiceClassName/ServiceMethodN
ame/Policy/<PolicyID>
Here, policy is the resource path and PolicyID will be set dynamically based
on PolicyID value.
Processing Options
End Requestor when done – This is applicable only for stateful sessions.
P a g e | 12
This is called stateful session. If the clipboard pages are cleared after
processing a request, then it can be called as ‘stateless’ session.
Execution Mode
Methods tab
1. GET
2. POST
3. PUT
4. DELETE
GET Method
POST Method
PUT Method
https://stackoverflow.com/questions/630453/put-vs-post-in-rest
DELETE Method
In GET method, we don’t need the request body. We can send the
request as query string.
P a g e | 14
Step 4: Create a new service activity – Handle all the processing logic in the
service activity.
Now, let us specify the request parameter PolicyID in query string parameters.
Its time to test our service. Let us test the same using PostMan application.
1. You can either ping the URL or use some external testing applications
like PostMan.
2. You can run the Service rule manually by providing the request
parameter.
Step 4: In the Postman app, click send button. You can verify the response.
Step 5: You can see the service activity run from the tracer.
In Step 4, you can see that we didn’t send any authorization, because we
didn’t add require authentication in service package rule.
Remove the query string and send the request in request body. Use the same
service activity.
Request
Response
I added a new response condition – Mapping error and set the error code to
‘001’.
P a g e | 17
If you are having more than one response conditions, then move the default
condition to the last.
For a change, we can run the rule and test the exception.
Step 2: Select method as POST and don’t provide any input. Execute it.
You can test for variety of response conditions Pega provides in the service
rule.
In the service activity, you can use the business logic to capture the exception
and send the error details in response page.
Step 3: If null, then set the error message in the response page and exit-
activity in the transition.
Step 4: Now, run the Service REST rule with PolicyID as null.
P a g e | 18
Things to remember:
Decide what type of service we need to expose like creating a new work
item from the request parameters or just processing the request and
sending the response values etc.,.
Default service URL format is http://:///
You can add the resource path to this URL and can be parameterized:
Decide the request parameters you need to process the request. Share
the same with the client. Also get the required response values, the
client anticipate from our service.
Decide on which HTTP protocol, we need to use – GET, POST, PUT,
DELETE. Maximum, we use GET or POST.
Create the Integration class structure, Request response properties,
Service-REST rule.
Build your own business logic inside service activity. Set the response
values in the service activity.
You can use JSON, XML, HTML formats as input. Preferably, use
JSON to gain its advantage over XML.
Decide if authentication is required for our service. Authentication is
recommended to secure our service.
Let me end this long post here 🙂 In my next post on Connect-REST, I will
include the debugging for both services & connectors.
P a g e | 19
Introduction
I will say Service package is the heart of Integration service rules in Pega.
On looking at the name, you can brief me about service package.
Incoming Request –> Process the request –> Send the response
I am gonna pick the middle part. How do we process the request in Pega?
We need Pega rules, right? How can we run a rule in Pega?
Services are not operators. So who gives them access to Pega rules.
This is not the only role Service package is being restricted to.
Please go through the ‘Requestor types‘ post to learn about APP requestors.
Cool, Service packages are data instances and don’t belong to any ruleset
versions. They are included in ruleset to support deployment in other
environments.
Once you have created a data instance, you can update the ruleset anytime.
1. Context tab
2. Pooling tab
Context tab
P a g e | 21
Processing mode –
Prerequisites:
Step 3: Configure the second service activity to just consume the value from
MyKnowPega page and set pyValue directly to response.
We have populated page in first service and are using the page in second
service.
In this case, you can make the service package stateful, so that different
methods (API) can reuse the pyworkpage and process the requests.
Requires authentication – On enabling this, you will get few other options.
Methods
P a g e | 24
This tab lists all the service methods included in this service package.
Deployment
Deployment tab appears only for selected service types like SOAP, Java,
DotNet etc.,.
SOAP – WSDL
You can select the service class and can optionally include the namespace
URI for SOAP service rules.
Deployment results
You can download the content from this link. Click on it.
You will contain the methods included in xml format. WSDL file.
Pooling tab
Pega not only reuse the rules, they reuse the requestors too 🙂
P a g e | 25
Step 2: Now hit our URL and check the requestor management page.
You will see a new requestor has got created to process the request.
It is like when you have a work, you sit in Active box and complete it. Once
you completed the work, you can move to Idle box and relax. 🙂
P a g e | 26
Scenario 2: Now, when a second service request comes from the client
system.
Pega effectively reuse the idle requestor for processing and it doesn’t
create a new requestor.
This is how Pega effectively reuse the requestors.
Scenario 3: Say, you have got 3 requests coming at the same time.
Pega checks the idle requestor and find only 1 in idle box. So it creates
2 new requestors to process the remaining requests.
After completing all the 3 requests, the three requestors move to the idle
box.
Pega reuses the three idle requestors and creates only 7 more new
requestors to process.
Because, in service package rule, we configured the maximum active
requestors to be 10. The other requests will be in queue waiting for
requestors.
For example, imagine, already 10 ideal requestors are available in pool. When
a new active requestor completes processing the request, it needs to enter
ideal requestors pool, but quota is completed already 🙂
You can specify Max Idle requestors ‘-1’, to allow unlimited idle
requestors.
P a g e | 27
Maximum active requestors – You can specify how many requestors can be
allocated to process different service requests coming to services in service
package rule.
As discussed above, when traffic comes to your service (say 20 at the same
time), only 10 active requestors will be available to process the requests.
You need to take this criteria to define the max active requestors.
You can specify Max active requestors ‘-1’ to allow unlimited active
requestors to process the requests.
Maximum wait (in seconds) – Specify the time before which a request fails
without processing.
When a service request comes in, no requestors are ready to process the
request. So the incoming request can wait for some seconds. Once the max
wait time is crossed, the request fails and system sends the error to the client
system.
Step 1: Open SMA and go the requestor management. Note the App
requestors.
Step 2: Hit your service URL and check the requestor management page.
You can see the service package name and all the configuration values for
requestor pooling.
On clearing, it will delete all App requestors that belong to the service
package.
You can verify in this same page as well as requestor management page.
Note: You need to have a long running service activity 🙂 (Not advisable in
real). Like this.
The reason is the active requestors can process the service requests in
milliseconds and go idle. So it will be reused again and again 🙂
Step 6: You can see new requestors created to process the requests.
Things to remember:
Introduction
This list can go endless from starting a day with friends and ending it in HIGH
🙂
1. Sharing data
Every business process revolves around data. This data can be available in
other applications. Pega needs to have a friendship with them, connect with
them and consume the data.
Imagine a call center application. The policy creation process is not handled
within Pega. Policy creation is handled by some legacy java application. Now
when the customer calls in and requests to create a policy, then Pega can
connect with java application for policy creation.
P a g e | 31
What is REST?
Difference between JSON & XML.
Why REST is preferred over SOAP.
HTTP methods.
What is a Connect-REST?
URL – http://
<HostName>/prweb/PRRestService/TestServicePackage/FetchPolicyDetails/
FetchPolicyDetails
Request – PolicyID
P a g e | 32
Response –
{ “SampleResponse”:
“PolicyType”:”Home”,
“PhoneNumber”:”9999999999”
}}
All the three basic information are handy. Let’s straightly jump to configuring
Connect-REST.
Designer studio -> Integration -> Connectors -> Create REST Integration
System details
Name – Enter the name of the system, which we are going to connect to
consume the service.
If you enter the complete URL path, then resource path will be pre-
populated.
You can see how the path is identified. Words separated by ‘/’ in the
URL.
You also have an option to make the resource path as parameter.
For GET & Delete HTTP methods, we can specify the query strings.
Headers
If the service expects any header values, then we can provide those in
header. Else, leave it blank.
Authentication
I will just touch the basics with respect to wizard. We will see more details in
Authentication posts.
Authentication scheme –
OAuth example – I think you might have come across this in many android
applications.
Since we are going to consume our own Service-REST, we will use basic
authentication here.
Service is also hosted in Pega. So provide any valid User name &
Password.
Remember in Pega service, authentication happens using service
package data instance.
Host, realm, preemptive authentication; leave it blank. We will see it
authentication profile topic.
Resource methods
P a g e | 35
Select the method on which the service is hosted. Here in the example,
we have used GET method.
You have an option to override the query string and header fields in this
screen.
Data Model
Here, you can specify the configuration for request & response parameters.
Sample – We can use the sample request & response to create the
Integration data model.
After providing the request, click Run. You will get the sample response.
2. Add a file – Use this when your service is not ready & when you have
the sample in file.
You will have an option to choose a file. You can either choose JSON/XML .
If you have notepad ++, then you can easily create a json file.
You can also create the JSON file online. You can use the link,
http://www.jsoneditoronline.org/
Provide the response sample and save the file to your disk.
Review
Integration layer
Here you can specify the Integration class name, connect-REST name,
ruleset name.
You can update all 3 with the edit icon.
Data Layer
You can specify the data type, data page name and ruleset.
You can also update those using edit icon.
P a g e | 37
It contains,
Request –
You may get a question now. “Why there is an extra layer out here? We can
set PolicyID directly in request page. So, why is there query_GET page?”
A single Connect-REST rule can support all four methods. You can
select all methods, with different request & response.
When you call from activity, you can choose which method to invoke.
Response –
1. request
2. query_GET
3. response_GET
4. SampleResponse
Data Transform
1. Service tab
Resource properties
Secure protocol configuration – You can specify the SSL/TLS version – Use
default.
Security settings
Connection
Methods tab
Request –
Response –
We are not going to reuse all the 4 methods. We will create only for POST
method.
a) Sample response
Service tab
Methods tab
P a g e | 42
In the POST method, map the request body from clipboard – .PolicyID
Response
For simple request, you can directly use property-set to set in the
request page.
For complex request, you can use a Data transform. Rarely, if you use
xml, then you can use xml stream in Property-set-xml.
P a g e | 43
Execution mode –
Step 4: You can use a data transform to set the response to required
properties. You can also use some parse rules to parse the complex
response.
You can see that the sample response page contains the response
values.
P a g e | 44
You will see, once the Connect-REST method begins, Pega Engine
invokes an activity ‘Invoke’ in class Rule-Connect-REST.
Say it SOAP, FILE or any connectors Pega calls ‘Invoke’ activity in the
respective class.
You can see the rule available in almost all the connector classes.
You can see in the 5th step, it validates the request data we configured in the
Connect-REST rule.
This is full of java code. You can see the step description and know
what is happening in each step.
6th step executes the HTTP method and response, error all set in Invoke
activity.
1. Connect-Method transition
Note: You need to specify both, when if true & on exception to capture
all the error conditions.
This is without error handling in transition step. All activities end abruptly
throwing exception.
P a g e | 46
When you use transition, the activity step jumps to the exception handling
step and the process resumes.
You can use an activity here to capture the exception in the data page and do
any required action.
Connection Problem
FlowProblems
Based on the business requirement, you can use your own customized flow in
the Error handling section – Error handler flow.
Go to Designer Studio -> System -> Operations -> Logs -> Logfiles ->
Pega Logs
2. Tracer – Since connectors run in the requestor session, run the tracer and
capture the exceptions.
You need to log all the steps involved in REST integration. You can use
loggers to print those in log files.
This is the logger class for Connect-REST.
Rule_Obj_Activity.pyInvokeRESTConnector.Rule_Connect_REST.Action
Go to Designer Studio -> System -> Operations -> Logs -> Log level
settings
Really, I need REST 🙂 Guys if you need any additional info or some
clarifications, then please feel free to drop comments below.
P a g e | 48
Introduction
We know we can login any email ID and send any email we want, but what
happens at the back-end?!
Step 1: You are in Chennai and you write a mail to your friend in Bangalore
Step 2: You go to post office and post the mail. (Your job over here)
Step 3: People working in Chennai post office identify the recipient address
and the respective post office. Then they send the mail to Bangalore post
office.
Step 5: Post man helps in carrying the mail to the recipient address. The job
ends here and your friend receives the mail 🙂
Scenario: You need to send an email from your personal Gmail ID to your
friend who use Yahoo ID
Step 2: The mail reaches the SMTP email server. Here I don’t use any proxy
network, so by default It reach the Gmail email server.
P a g e | 49
Step 3: SMTP Email server uses DNS to identify the Email server of the
recipient email address aarti@yahoo.com Yeah its Yahoo 🙂. It sends the mail
to recipient email server
Step 4: The recipient Email server receives the Email and they can use IMAP
or POP3 protocol.
Step 5: Finally the recipient – aarti@yahoo.com receives the email using any
one of the above protocol
What are the things required for you to create an outbound email
account?
1. You need to have an valid email address from a valid email providers
(google, yahoo etc)
2. You need to know the SMTP email server details
Step 1: Designer studio -> Integration -> Email -> Email Wizard
P a g e | 50
a) Receive an email and create a workobject – Use it for email service, when
we need to process the incoming emails
If you check this option, you can make this email account as default account –
Means a common account.
Every email account can be tagged to a work pool. Actually, the email
account data instance name will be the same as the work pool name it
is tagged to.
But it is not mandatory for every work pool to have an email account.
Now think Pega handles this? Before sending an outbound email from a case,
Pega checks If there is any email account tagged with the case work pool.
If Yes, then Pega sends the mail from the email account.
If No, then Pega sends the mail from Default email account.
Default Email account can act as a base (common) email account in a Pega
application.
P a g e | 51
So, when you want to create a Default email account check the checkbox.
Which work pool will be associated with this email account – you can
select the workpool from the dropdown.
In this tutorial, we will create a new email account for the workpool ‘OIKGGB-
MyKnowPega-Work’
Select email provider – provided with a link. You can click on and select an
email provider.
From – Enter the mail ID, from which you will be send the email
User ID – If there is some email ID the SMTP host use, then specify the ID
there, else you can copy the same from ‘From’ field we used above
Reply To – You can enter a valid email address, so that recipients of the
outbound email can reply.
Connection
This is where you configure the details about SMTP email server
What are the things to note down, when configuring SMTP Host?
Here I use personal edition & connected directly with internet. I don’t
have any proxy connection between. So, I use the Gmail SMTP host
‘smtp.gmail.com’
If you are connected in any Organization proxy network, then you need
to specify the SMTP host of the organization email server not the Gmail
SMTP host
Inside proxy network, If you provide the Gmail host and test the connectivity,
you will get the below error
If you see this type of error, then please check with administrators and get the
Organization Email server host name 🙂 (this may occur, If the Gmail SMTP
server down too. This is very rare 🙂)
P a g e | 53
Note: To make any connection to any server, you need an open port
connection.
a) 25 – This is the default port used for transmitting mails between servers.
Introduced very long back, before I came into this world.
c) 465 – This port was introduced to support SSL means of sending email
messages. But the same can be done by 587.
25 – This is still used by many email servers around the world. This is
mainly used when we need to relay the emails between different email
servers. The main drawback is this can be exploited to spread spam &
malware
Note: If you use Organization email server(proxy network), then you need to
get both the host name and port number from the administrator
Note: My advice (If no proxy network) go with 587 port to connect email
servers
Use SMPTS? –
P a g e | 54
As I mentioned before, this is not recommended. Port 587 can secure the
message.
Message signing –
The email servers help in relaying emails. If they don’t use secure
connection, then there is a possibility that the email can be read by
hackers.
To encrypt the email.
How do we do it?
Step 1: You need to get the help from companies that offer digital certificates
(.jks or .pfx )
Digital certificates – they are the public and private keys which can be shared
only with the recipient to decrypt the email
Step 3: Include the keystore instance in the message signing section email
account.
Note: You need to share the key with the recipient to decrypt the email.
Receiver
Though we are going to configure mail ID only for outbound, we need to fill out
the receiver section too for inbound email to avoid wizard validation.
P a g e | 55
Identity
User ID – Same as sender fill the email ID to receive the incoming emails
Password – Input the password for the User ID you use above.
Connection
Note : At this point, the email is available in the receiver email server. Now
the receiver mail client ( mail ID) needs to access the mail from the server.
Say you have synced your mail ID s in both mobile and laptop.
POP3 –
When you access the Gmail to check the mails from laptop, the mail
gets downloaded in the laptop and gets deleted from the email server.
So when you try syncing from mobile, you will not find the mail.
It use 110 (unsecured) , 995 (secured) port numbers
IMAP –
When you access the Gmail to check the mails from laptop, the mail still
resides in the mail server and will not be deleted.
It use 143 (unsecured) , 993 (secured) port numbers
Host Name – you can specify the receiver emailing server hostname
Note: As we saw before in sender section, If the client receives the mail inside
proxy network organization, you need to get the hostname port number from
the administrator.
P a g e | 56
Use SSL/TLS – You can use SSL/TLS connection to receive the email
Advanced parameters
For example, when you use Microsoft exchange servers to receive the
incoming email, you need to disable plain authentication
Step 5: You can see the email account created in the confirmation screen.
You can see all the details completed from the wizard.
Use the test connectivity button at the top to test the connection.
P a g e | 57
Step 1: login the email Id, you provided in the sender information.
Step 2: Click on your profile pic in top right corner and open My account.
Now the mail account is ready to send any mail to anyone from Pega 🙂
Step 1: Open the flow rule and add a Send Email shape from smart shapes
palette.
Step 2: Double click on the Send email shape and configure the properties.
You can see the mail successfully attached with the case.
Things to remember
You can follow the above steps in the post and try sending email from
Pega 🙂
Introduction
In this post, we will see how a Pega system host a SOAP web service.
Please go through the below link to get some basic detail about services in
Pega.
http://myknowpega.com/2017/05/30/service-rest-step-step-tutorial/
What is SOAP?
http://myknowpega.com/2017/07/04/wsdl-structure-relation-pega-rules/
http://myknowpega.com/2017/07/18/xml-mapping-rules-xml-stream/
http://myknowpega.com/2017/07/18/xml-mapping-rules-extended-parse-
xml/
P a g e | 60
Request – CustomerID
Pega makes the process simple :). We got a wizard to implement SOAP
service in Pega.
What are the rules required before running Service SOAP wizard?
1. Primary class – It can be integration class, work class or any data class
( No need to create a new class, if you can reuse any existing class)
2. Properties – Request and response data model properties. ( No need to
create new properties, if you can reuse existing properties)
Note: We know page properties should contain page definition.So, create two
classes for request and response.
Request – TVS-Int-GetCustomerDetails_Request
P a g e | 61
Response – TVS-Int-GetCustomerDetails_Response
Request –
Click on the application explorer and check the main integration class. You
can see the request, response page properties.
Once you created all the above properties, you can again go and see the
data model structure from App explorer.
a) Create and manage work – Use this option, when the service wants to
create a new workitem
b) Invoke existing activity rules – In some scenario, the service activity can be
existing activity.
Say for example, you already have an activity that accepts customer ID and
returns all the customer details. Kind of search screen in user portal. You can
make use of that same activity in Service SOAP rule. Here you can use
‘Invoke existing activity rules’ option
c) Process input or output data – Use this option, when you need to make use
of the input data and perform some process (no existing activity is reused as
service activity).
For all the above three service purpose, the main difference is service
activity.
Create and manage work – Wizard creates a service activity, which includes
steps to create a new work item.
Service Type –
P a g e | 63
Pega provides the same wizard for different service types. Steps vary
based on the service type.
Select – SOAP and click next.
Data here refers to input output data. You can provide the Main
integration class here, which contains the input, output properties. ( You
can also provide any class)
Service name – Choose a name for the service that will be generated.
Remember, we already created the data model structure for request and
response.
Request structure
P a g e | 64
Since it is a simple request, we don’t need any XML structure. But keep in
mind, in future if we need to add more complex properties, then we can use
XML for data mapping.
Response structure
Same like request structure, you can select the response properties 🙂
You can see an additional checkbox – Return process info XML data
c) Use an existing service package – You can make use of any existing
instance
The only data instance, we create here is service package data instance. So
it’s obvious that we will be configuring service package data instance.
Please go through the post on service package data instance to get to know
about all those configurations.
http://myknowpega.com/2017/06/02/service-package-configuration-tutorial/
Click next.
You can see totally 4 rule instances and one data instance got created.
P a g e | 66
1. Service-SOAP rule
2. Service activity
3. Parse XML rule
4. XML Stream rule
5. Service package data instance
1. Service
2. Request
3. Response
4. Faults
5. XML Page
6. Advanced
Service tab
This tab look more or less same as Service-REST rule – service tab
http://myknowpega.com/2017/05/30/service-rest-step-step-tutorial/
Primary page
Data transform – You can use a data transform, to initialize some properties
Service activity
Activity name – You can specify the service activity name and its parameters,
if any.
a) Document / Literal
b) RPC / encoded
c) RPC / Literal
Document style model is used when the SOAP message body is XML
instance. Use RPC when the SOAP message body is simple data type
(string).
So in document style, we send message as discrete elements where as
in RPC style message send as XML content.
1. Encoded
2. Literal
http://myknowpega.com/2017/07/04/wsdl-structure-relation-pega-rules/
P a g e | 68
Processing options
What is MTOM?
https://stackoverflow.com/questions/215741/how-does-mtom-work
Execution mode –
d) One – way operation (queue for execution) – queues the request and return
only HTTP response code.
P a g e | 69
Request tab
SOAP action URI – you can specify the SOAP action HTTP request URI
Request headers
Cool you don’t use those much. Often you end up using either Clipboard or
XML Parse rule.
Request parameters
Data type – SOAP request body supports wide variety of data types.
In our example, Wizard created a Parse XML rule and it is populated in the
Service SOAP.
P a g e | 70
Response tab
Faults tab
a) When – You can specify a when rule to check any error conditions, If true
system returns the fault message specified.
Note: When anyone of the fault condition evaluates to true, then system
returns the fault message alone. Only if all fault conditions are false, then
system returns the normal response message.
b) Queue When – There may be some situation, where the service activity
needs to obtain a lock to process the request. If the case is already locked by
other user, then we can queue the request for ‘Service Request Processor’
specified in the Service tab for background processing.
e) Service error – If there is some other problem with service, then we can
return a service error fault message.
When Key – If the condition is when or queue when, you can specify a when
rule here.
Map from, map from key are same like request response tab
Fault detail key – used to return the fault message in XML stream
XML Page
The actual purpose of this tab is to map the incoming request proeprties
to a page specified. Data transform helps in setting the proeprties.
Key point to note here is we don’t set any value in the data transform 🙂
Advanced tab
http://myknowpega.com/2017/07/18/xml-mapping-rules-extended-parse-xml/
http://myknowpega.com/2017/07/18/xml-mapping-rules-xml-stream/
Service activity
You can see the service SOAP is included in the Service package
instance.
For more details on service package instance, please follow my below link
http://myknowpega.com/2017/06/02/service-package-configuration-tutorial/
You can see the WSDL file created for our Service SOAP
click on the WSDL file, you will find the WSDL source.
P a g e | 73
http://myknowpega.com/2017/07/04/wsdl-structure-relation-pega-rules/
Step 1: In the faults tab – Handle fault condition for security error.
In the requestor context – select Initialize service requestor context and make
the user ID and password empty.
When you host a SOAP web service, you are the boss. You decide
everything!!
Have some detailed analysis about the service requirement and decide
the request, response structure.
Once you confirmed all the required and response structure, you need
to create all the request, response data model and the integration
classes.
Once all pre-requisites are ready, go ahead and start the wizard.
I suggest you to use the ‘process input or output data’ option. It’s a 3 in 1
option 🙂
Select your data structure. You can use XML mapping rules.
Once you complete the wizard, you can verify all the rules.
Open the service package data instance and check your Service is
included.
You can provide the same WSDL file to client systems, so that they can
make use of your SOAP service.
I will be consuming the service hosted by Service SOAP example in the above
post 🙂
What is SOAP?
We are sending the request to access the customer details – Object accessing
Imagine there are 2 main process – Quote creation and Policy creation.
So Obviously, they have to Seek Pega help to provide the Customer service solution (
CRM product): D.
Now say a customer called customer service application and need to create a new
policy. What will you do here?
Approach 1: Replicate the policy creation process in pega application (build all the
required rules, cases etc)
Approach 2: make use of the existing policy creation process handled by dotNet
application.
It means we need to communicate with the dotNet application and tell them to
create a new policy.
To achieve this, a web service should be hosted in dotNet application and
exposed, say Policy Creation service.
We see now many new pega application prefer using REST web service over
SOAP service
SOAP Nodes – Between sender and receiver, there can be many nodes used in
transferring the SOAP mesage. All those are called SOAP nodes.
SOAP Header – A SOAP header can contain one or more blocks. Each block can
identify individual receivers. Optional
SOAP Fault – when any particular node fails to process the SOAP message, the error
details are stored in Fault content as a SOAP body child element. Optional.
WSDL File – XML based language. External system use this WSDL file to describe the
web services available. They provide a standard way for web service providers and
consumers to work together.
Please go through my previous post on WSDL file basics. It will be really helpful
proceeding further.
We will see the Customer ID as request parameter and get all the customer details as
response.
Request – CustomerID
What are the basic parameters required from the service providers to consume the
service?
c) Operation – We know that single service can contain more than one operation.
GetCustomerDetails.
e) Message
Request – GetCustomerDetailsRequest
Response – GetCustomerDetailsResponse
P a g e | 79
You see all the details are available in the WSDL file 🙂.
If you don’t’ have a WSDL file, then do the following. You don’t want to create
any properties or classes manually 🙂
Step 3: It opens the service SOAP wizard. You can just follow the wizard steps and
complete it.
Note: The Integration wizard can consume the WSDL file and make use of some
existing OOTB activities to create the integrations. All process are automated by the
wizard.
Like Service-SOAP, we don’t want to create any Integration class or data model
properties prior. Wizard takes care 🙂
To use wizard, we need the WSDL file from the service providers. This is the only pre-
requisite.
Step 1: Designer Studio -> Integration -> Connectors -> Create SOAP Integration
Note: WSDL document can be downloaded and available in local machine or it can be
hosted in another server.
Most probably, the external app servers will be secured using credentials. So when you
use this option, you may be prompted to provide the credentials.
I will explain, how I saved the WSDL file from the service-SOAP.
Step 1: Open the service package data instance and check the WSDL file.
Step 2: click on the WSDL file and save the contents in note pad WSDL file.
Click on next.
P a g e | 81
You can see all the details are populated from WSDL file 🙂
Operation – GetCustomerDetails.
Note: You can test the service prior using test button. Click on the test button.
Click on next.
Integration layer – You can specify the Integration class integration rule set here 🙂
Context – I have specified to create a new Int ruleset. You can make use of any
existing ruleset.
1) Integration class
We know page type properties refer to some page definition. Other classes basically
support these request, response data model properties.
You can see all the main integration rules – properties, connect-SOAP, XML
stream, Parse xml rule are included
You can see the data model for the request, response properties.
Activity – You can use Connect-SOAP method in a activity to invoke the SOAP
integration.
Integrator shape in flow rule – Connect-SOAP method -> Connector activity ->
Integrator shape -> Flow rule. You can invoke the SOAP integration inside a flow
rule.
P a g e | 83
Data page – You can load the Connect-SOAP response as the source for any
data page
a) Service
b) Request
c) Response
d) Faults
e) Advanced
f) WSDL
Service tab
Service Properties – You can see all details are just populated from the WSDL file.
a) Document / Literal
b) RPC / encoded
c) RPC / Literal
What is the difference between RPC and document?
Document style model is used when the SOAP message body is XML instance. Use RPC
when the SOAP message body is simple data type (string).
So in document style, we send message as discrete elements where as in RPC style
message send as XML content.
You have two models to use for the above styles.
1. Encoded
2. Literal
So totally 4 style combinations are available
1. RPC Encoded –This is deprecated. Use to support legacy services
2. RPC literal -Use it when the request is simple parameters (Can be directly mapped from
clipboard)
3. Document Encoded –Not applicable in Pega
4. Document Literal –Use it when the request is in XML format.
For more info – Please go through the WSDL structure post.
http://myknowpega.com/2017/07/04/wsdl-structure-relation-pega-rules/
Method Name – Operation name populated from the WSDL file – GetCustomerDetails
Namespace URI – Populated from the WSDL file. Optional
SOAPAction Header – Refer to the header request message. Populated from the
WSDL file. Optional
P a g e | 84
Request only – there many be some situation, when we need to send only the request
message and don’t expect any response from the service. In such case, you can check
this option
True – Asynchronous. Once system sends the request, connection is terminated.
False – Synchronous. System waits for the response.
Authentication
If the service providers, expect any authentication, then you can use this option
to authorize the request. You can use an Authentication profile instance to
configure the authentication credentials.
We will see about authentication in separate post 🙂
Connection
Service endpoint URL – This will be populated from the WSDL file – Address location
value.
This is the URL, where the service is hosted. You need to hit the URL to make
use of the service.
So how long can we wait for a response. It all depends on the business
requirements.
If you want to wait indefinitely for the response, you can have the value as “0”or
null (leave empty). Else you can specify a certain interval in milliseconds. Once
the timeout is reached and the service returns a timeout error.
In short, stateful sessions are used to maintain the same session for logically
related connectors. Same session refers to sharing clipboard pages.
You can have a connection ID, kind of token that can be used in all the logically
related connectors.
Maintain session ? –
False – If this is the last connector in the logically related connectors, then uncheck this.
So the session will not be maintained. Clipboard pages will be cleared.
pyStatusValue – Holds the HTTP code. 200 for success and other codes for failure
Error handler flow – You can make use of a flow to handle error.
Say for example, You have created a case and using the connector in the flow rule. If
the service fails, we can make use of this connection problem flow to handle the error.
Invocation exception property – Java object to hold the jave exception stack.
Processing Options
Intended for –
Request Processor – You can specify a connect request processor instance to support
synchronous processing.
P a g e | 86
Request tab
Request header –
Some service can expect some fields in the request headers. For example –
authentication parameters. We can set those fields, in the request headers.
You can either map from clipboard, constant ( simple request headers) or XML Stream
for complex request headers.
Data type – You will have a variety of data types to choose from
Response tab
SOAP envelope content – If you need to capture the entire XML response content,
you can use this option. Specify a single value property to hold the entire xml content.
Response parameters –
Faults tab
This tab is used to record the SOAP fault code and details. All the fields are defaulted to
standard properties.
We already error handling in service tab is used to handle the exception cause
by Connect-SOAP method.
When there is SOAP fault return by the web service, then this tab will be useful
to capture the Fault details.
Please follow the link and search ‘fault code’ to know more details
http://www.w3.org/TR/2007/REC-soap12-part1-20070427/
Target property – single value property to hold the entire content of SOAP envelope
that contain the fault message.
Fault code property – single value property to hold the SOAP fault code
Reason property – single value property to hold the SOAP fault reason
Detail property – single value property to hold the SOAP fault details
Advanced tab
Client properties
SOAP Version – Based on the binding port in the WSDL file, this field will be auto-
populated
Enable MTOM? – We know that SOAP messages involve many nodes between sender
and receiver.
This mechanism helps in effective transmission of binary data to and from web
services.
Lowest allowable SSL/TLS version – For connection with HTTPS end points, we can
determine the secure protocol.
You can make use of either WS-security instance or web service policy instance
to secure the connection. We will see more in details in separate post.
WS-Addressing
Address the SOAP header fields. This will be pre-populated by the wizard.
This block helps in executing some action, when the connector rule succeeds in
receiving the response.
Say for example, imagine purchase request case invokes GetCustomerDetails and the
service returns a valid response. In this case, we can use an activity to run on
pyWorkPage and can execute any compensating action.
Compensating action can be another service call to get the Policy details
‘GetPolicyDetails’.
Mostly you wont update anything in advanced tab and accept the values defaulted by
the SOAP wizard.
WSDL tab
You can see the XML stream rule created by the wizard – GetCustomerDetailsRequest
For more details on XML Stream, you can visit my previous post
You can see the Parse XML create by the wizard – GetCustomerDetailsResponse
For more details on Parse XML rule, you can visit my previous post
How simple is this 🙂. We have successfully created all the Connect-SOAP integration
rules using SOAP wizard.
How can you undo the wizard creation process and delete all the rules created by
the wizard?
Step 1: Designer studio -> Integration -> Tools -> Wizard cleanup
You can see, whenever you start a wizard Pega creates a work item using OOTB
activities. You can see the label and ID. For every SOAP integration wizard, pega
creates a case with id ‘pxDataSource’. Once you complete the wizard, pega resolves
the case – Resolved-Completed.
Step 3: You can click on Undo generation to delete all the rules created by the wizard.
P a g e | 91
Note: The wizard will not delete the rulesets created. Please make a note and manually
delete the newly created rulesets.
Step 2: Add 2 steps , Page-New followed by property-set to set all the request
parameters.
Step 4: Trace open the rule and run the activity. Click on the step page to check the
response.
2) Now add step 5 to set error code and error desc parameters.
3) In the Connect-SOAP rule, update the endpoint URL from https -> http ( you can
reverse in your own choice)
You can see activity run, throws exception and abruptly stops at step 3.
This will cause the run time exception and stops the process. You may get the
same error screen in user portal.
You can also click on the step 3 step page to check the error handling property values.
In the transition step, you can use StepStatusFail when rule, to check the step
status.
If the method status fail, then we will jump to EX label step (5th step)
You must use these option, when you use Connect methods. Connect method may
result in java exception. This option can capture java exception and jump to exception
step.
Note: Always check the method status as well as java exception in transition error
handling.
You can see, we have handled the exception in step 3 and jumped to step 5.
Step 1: Copy the activity to work class and update the activity rule to Usage – Rule
Connect in security tab ( testing)
Step 2: Open any exiting flow rule in work class ( or create a new flow rule).
P a g e | 93
You can see exception is handled in the transition step and the ConnectionProblem is
not executed.
Step 6: Remove the transition from the connector activity Connect-SOAP method.
Note: You can customize the connectionProblem to meet your business requirement.
When you are using wizard, you need the WSDL file or WSDL file location as the
only pre-requisiste.
Wizard can create all the supporting integration rules related to Connect-SOAP
integration.
Connect-SOAP supports only XML as messaging format.
You can also secure the SOAP connection using WS-Security.