Question
Jabil
US
Last activity: 4 Jan 2019 15:18 EST
Data Page REST Load Error
Working with 7.1.9 I need to load data pages from a REST call to vendor's API. If specifying the data page source Connector REST, the page executes without error but fails to include anything on pxResults for a List structured page. This happens almost every time, but occasionally works.
However, if I trace the page load it works. Every time.
Clues anyone?
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
EPAM Systems, Inc.
ES
Is Connect-Rest working as expected independently?
It could be verified by looking into "pyRawMessage" property on your integration page. It will contain the raw JSON response.
Alternatively, try tracing "pyInvokeRESTConnector" activity and look for "responsePacket".
It would help in isolating the issue.
Jabil
US
Thanks Asif. Yes, Connect-Rest works every time independently so I hadn't triple checked, but it's a good idea. This is XML, not JSON, so I placed param.xmlString in my integration page and checked the clipboard. Integration is working fine. It has to be a bug in 7.1.9, like a timing issue.
Again, tracing doesn't help - it makes the problem go away.
On a whim I tried RunInParallel and Connect-Wait, and it appears to be working.
FWIW, this isn's just an issue with the Data Page execution harness. I first discovered the problem exercising the app from a flow.
Jabil
US
Final note on this issue. This is definitely some sort of defect with this (very old) Pega version 7.1.9. I'm stuck right now and cannot upgrade or patch the system.
My workaround previously mentioned had the disadvantage of always requiring Data Page loader Activities and using RunInParallel for no good reason, which is a Bad Idea if you can avoid it. Besides that, I still had failures REST-Connect failures occasionally. The integration call definitely worked - I just ended up with a blank integration page.
Long story short, discovered by accident while debugging that modifying pyInvokeRESTConnector's "Execute HTTP Method" step with the line in bold...
//put the response body into the map
final ClipboardPage resMessagePage = resMessageParams.getPageValue(1);
final String messageName = resMessagePage.getString("pyParameterName");
resMessageVal.put(messageName, responseBody);
oLog.debug("Mapping response parameters to clipboard");
svcUtil.startConnectInMapReqTimeStat();
try
{
svcUtil.mapInboundData(resMessageParams, resMessageVal, pp, objPage);
objPage.getJSON(true);
}
catch (InboundMappingException e)
{
Final note on this issue. This is definitely some sort of defect with this (very old) Pega version 7.1.9. I'm stuck right now and cannot upgrade or patch the system.
My workaround previously mentioned had the disadvantage of always requiring Data Page loader Activities and using RunInParallel for no good reason, which is a Bad Idea if you can avoid it. Besides that, I still had failures REST-Connect failures occasionally. The integration call definitely worked - I just ended up with a blank integration page.
Long story short, discovered by accident while debugging that modifying pyInvokeRESTConnector's "Execute HTTP Method" step with the line in bold...
//put the response body into the map
final ClipboardPage resMessagePage = resMessageParams.getPageValue(1);
final String messageName = resMessagePage.getString("pyParameterName");
resMessageVal.put(messageName, responseBody);
oLog.debug("Mapping response parameters to clipboard");
svcUtil.startConnectInMapReqTimeStat();
try
{
svcUtil.mapInboundData(resMessageParams, resMessageVal, pp, objPage);
objPage.getJSON(true);
}
catch (InboundMappingException e)
{
... fixes the problem. It introduces some cost, but the backing Jackson ObjectMapper stuff is really fast, and at least it works now. The data page Connect-REST loader now works. My guess is some bug or omission in ServiceUtils, and invoking clipboard page serialization completes an action somehow.
Pegasystems Inc.
US
I'm pretty familiar with this code, particularly on 7.1.9. Not sure why you need to add "objPage.getJSON(true);".
I suggest an SR - we can try to recreate it in-house and then get developer to look at it. It would be best if we tested with a payload matching yours as closely as possible. Sample payloads for working and non-working scenarios would be very helpful.
Also, have you tested SwitchToOldAssembler DSS? The Pega 7 assembler is faster but is much less forgiving - many customers see no downside to using the assembler from PRPC (pre-Pega 7). Here is an example of how it resolved a similar use case.
https://collaborate.pega.com/question/connect-rest-wizard-not-setting-response-xml-parsing-correctly
Jabil
US
Unfortunately I am unable to create an SR at present. To make things worse, this is not very consistent. Just now I tried to undo my workaround, but I cannot induce a failure. I am 100% sure that previously I was toggling between failure and success by removing the workaround, so who knows what's happening. Probably a race condition.
This does not appear to be payload related. The other system is Coupa, which is very straightforward. Furthermore, it does parse at times, so the DSS you mentioned is a possible avenue but unlikely. Anyway, I'll keep limping along until maybe we can upgrade to Pega 8 late this year.
If I were to try the DSS, what is the exact entry? It does not currently exist in my system.
-
Daniel Zhuang