Question
Virtusa
US
Last activity: 12 Aug 2018 16:48 EDT
pyRequestData Param data in Connect-rest
Hi ,
How can we print pyRequestData (Which Contains JSON Request) in Connect-Rest invocation ? If i use Param.pyRequestData , nothing is logged .
Attached is the screen for reference .
Appreciate you response .
Thanks.
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Virtusa
US
after connect rest method , below java code can be inserted to print the request in JSON.
ParameterPage TestPP = tools.getParameterPage();
java.util.HashMap TestreqMessageData = new java.util.HashMap();
TestreqMessageData = (java.util.HashMap) TestPP.getObject("pyRequestData");
Iterator it = TestreqMessageData.entrySet().iterator();
while (it.hasNext())
{
Map.Entry pair = (Map.Entry)it.next();
String strReqJSON = (String) pair.getValue();
oLog.infoForced("Connect-Rest Request is : "+strReqJSON);
}
JPMorgan Chase & Company
US
Hi,
I hope you want print request data in log file. please enable debug level logging in below class to get that.
com.pega.pegarules.integration.engine.internal.connect.rest.RESTConnector
Virtusa
US
Thanks , but if we need to do in in our activity , is there any way we can capture from Param page ?
P.S : Making this to debug also works - Rule_Obj_Activity.pyInvokeRESTConnector.Rule_Connect_REST.Action
Pegasystems Inc.
IN
Did you try as below in java step?
String request= tools.getParamValue("pyRequestData");
oLog.infoForced(request);
-
Anuradha Bandara Halpandeniya Wijayakoon Weebadde Ralalage Missy Rayn Emmanuel Astillero
Virtusa
US
its not working , attched is the cdoe and tracer screen
-
Dan Leasure Akhil Reddy Patpi
Virtusa
US
Any help is much appreciated , Thanks
-
Divya Munigela
Virgin Media
GB
Hi Adithya,
Please see this post https://collaborate.pega.com/idea/how-do-you-get-raw-json-clipboard-conversion
I had exactly the same issue as yourself and I implemented the function the post refers to and it works.
Cheers
Craig
Virtusa
US
Thanks Craig , so we cannot directly use pyRequestData paramater ? only way is to write a function as in the link you provided
Coforge Technologies
AU
Hi,
If you need in a JSON format, you can use the function @pxConvertPageToString(tools,Primary,json).
Thanks
Surya
Accepted Solution
Virtusa
US
after connect rest method , below java code can be inserted to print the request in JSON.
ParameterPage TestPP = tools.getParameterPage();
java.util.HashMap TestreqMessageData = new java.util.HashMap();
TestreqMessageData = (java.util.HashMap) TestPP.getObject("pyRequestData");
Iterator it = TestreqMessageData.entrySet().iterator();
while (it.hasNext())
{
Map.Entry pair = (Map.Entry)it.next();
String strReqJSON = (String) pair.getValue();
oLog.infoForced("Connect-Rest Request is : "+strReqJSON);
}