Support Article
JSON invalid property error, when prop name starts with "_"
SA-15377
Summary
A service call to an external service, that returns a JSON object containing JSON property with underscore ("_") in the name, (for example, "_type") throws error.
Error Messages
2015-09-16 05:43:51,162 [ WebContainer : 6] [ STANDARD] [] ( engine.internal.ServiceHelper) WARN - The reference __type is not valid. Reason: invalid property name: '__type', update "@baseclass.pyInboundIdentifierEncoder" and "@baseclass.pyOutboundIdentifierDecoder" decision tables to replace the invalid character in the incoming request data.
2015-09-16 05:43:51,167 [ WebContainer : 6] [ STANDARD] [] ( internal.mgmt.Executable) ERROR - Exception
com.pega.pegarules.pub.services.InboundMappingException: Error mapping incoming response to .Response: com.pega.pegarules.pub.PRException: PRException
From: (H5486F38621DB11E688C51B6B33313995)
at com.pega.pegarules.integration.engine.internal.util.PRServiceUtils.mapInboundData(PRServiceUtils.java:1267)
at com.pegarules.generated.activity.ra_action_pyinvokerestconnector_fc074fcfd08f456a146ef116b16a2c3f.step7_circum0(ra_action_pyinvokerestconnector_fc074fcfd08f456a146ef116b16a2c3f.java:1837)
at com.pegarules.generated.activity.ra_action_pyinvokerestconnector_fc074fcfd08f456a146ef116b16a2c3f.perform(ra_action_pyinvokerestconnector_fc074fcfd08f456a146ef116b16a2c3f.java:171)
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3500)
at com.pegarules.generated.activity.ra_action_invoke_6a91441c4f6e5048b63360383ae1b952.step7_circum0(ra_action_invoke_6a91441c4f6e5048b63360383ae1b952.java:1002)
at com.pegarules.generated.activity.ra_action_invoke_6a91441c4f6e5048b63360383ae1b952.perform(ra_action_invoke_6a91441c4f6e5048b63360383ae1b952.java:172)
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3500)
...
Caused by:
com.pega.pegarules.pub.PRException: Error mapping incoming response to .Response: com.pega.pegarules.pub.PRException: PRException
at com.pega.pegarules.integration.engine.internal.ServiceHelper.setInboundJsonValue(ServiceHelper.java:1791)
at com.pega.pegarules.integration.engine.internal.ServiceHelper.setInboundDataValue(ServiceHelper.java:1594)
at com.pega.pegarules.integration.engine.internal.ServiceHelper.mapInboundData(ServiceHelper.java:1421)
at com.pega.pegarules.integration.engine.internal.util.PRServiceUtils.mapInboundData(PRServiceUtils.java:1259)
Steps to Reproduce
Use Connect-REST to invoke a REST connection that will return a property that starts with an underscore. It fails when it tries to map back.
Root Cause
An issue in the custom application code or rules. When using REST integration wizard to generate properties and data mapping, PegaRULES engine handles the scenario where property name starts with an underscore. The Engine renames it and appends uScore in the beginning of the property name, for example, it would rename "_type" property to "uScore_property".
In this scenario, properties were not generated using REST integration wizard but were created manually. Pega does not allow user defined properties that start with underscores.
Resolution
Perform the following local-change:
1. Add pzExternalName qualifier to Advanced tab of the properties where the issue is occurring.
2. Map the pzExternalName qualifier for the property, such as, uScore_type and set the value as the _type (original JSON name).
Published January 31, 2016 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.