Friday, May 8, 2020

Trace SOAP request, response when Pega connects to external Service

Once we are successfully done setting up all the integration rules in Pega to connect to external SOAP Service. We start sending SOAP request from Pega, and receive the SOAP response from external SOAP Service. In a happy path, we send the request and we get the expected response. Suppose if there is any scenario where you are not getting the expected result from SOAP Service, to drill-down to the root-cause we would be interested in tracing the SOAP request that went from Pega to external system. And the SOAP response that came from external service to Pega. In this post, we would talk about tracing the SOAP request/response while Pega connects to external SOAP Service.




Context:
In this scenario, Pega connects to external SOAP Service (Calculator) for multiplication operation. As shown in above image, Pega sends two integers in the request (5, 5) and we get the result as 25 back from the system. Assume that user is passing 5 and 6 in the request, and he would like to see the SOAP response envelope from tracer for debugging, then we can follow the below steps for the same:

#1 From our previous post: we have already created data page which has Connector as the source i.e.  D_Multiply. Navigate to Data Page >> Actions Menu >> Trace.


#2 Enter the integers in intA and intB. In this case, enter 5, 6 (for example). And open the Trace before clicking on Run.

#3 From Tracer, click on Settings >> Select "SOAP Messages", and click on OK to save the settings.


#4 Once Tracer settings are saved, Click on "Flush all instances of this data page before execution" to ensure data page execution hits the data page source instead of picking from cache. And click on "Run".
#5 For the successful run, you would notice like below: where we see the result property i.e. MultiplicationResult is set to 30 i.e. 5 multiplies 6 = 30.


#6 From tracer, do a Ctrl+F to find "SOAP Messages", then you would find the instances as highlighted below i.e. "SOAP Request Messages" and "SOAP Reponse Messages".

#7 Successfully we have traced and located the SOAP Request and SOAP Response Messages. Now you know what to do: just click on "SOAP Request Message" to view the SOAP request. And click on "SOAP Response Message" to view the SOAP response.

The above post looks simple and very basic right. But this concept is enough for debugging any scenario of  "Pega connecting to external SOAP Service": to view the SOAP Request envelope and SOAP Response envelope

Real-time scenario where you can apply above debugging technique:
From Pega you are hitting external SOAP Service: RiskRanking Service for operation GetRiskRanking:
Request: From Pega, we pass CustomerID
Response: We are expecting RiskRanking as "LOW" or "HIGH".

Due to some reason RiskRanking is coming as empty in the reason. Now you want to verify if this is a problem with external SOAP service or problem from Pega side parsing the response. So we can follow below steps to debug the same
- We would make a hit to service from pega once again this time with tracer, and settings captured with "SOAP Messages" and inspect the SOAP request and response envelopes. 
- If the SOAP response doesn't have RiskRanking value, it is issue with service. 
- And if response has RiskRanking and not mapped to Pega, then it is an issue with Pega parsing the response. 

In real-time, service responses will be huge, but that is fine. If we know this basic concept well, then it's just matter of applying it. 

Thanks,
HowToPega

3 comments:


HowToPega : All rights reserved and the contents are copyrighted to Pavan Kumar Naidu