Support Article
Connect Rest is giving error with data page
SA-31993
Summary
User is on Pega 7.1.8 and has configured a REST connector that is failing with the below error while parsing the response from the service.
The response has (_index) property which is being mapped to index property of Pega data model. The pzExternalName qualifier for index property is set as (_index).
But this is not helping. Also, they tried to configure "undrscr_" in the decision tables named "@baseclass.pyInboundIdentifierEncoder" and "@baseclass.pyOutboundIdentifierDecoder" and tried to set the DSS "json/LegacyMapping" to true. This also did not help.
The sample JSON response causing the issue is as below:
{
"took":1,
"timed_out":false,
"_shards":{
"total":1,
"successful":1,
"failed":0
},
"hits":{
"total":31,
"max_score":0,
"hits":[
]
},
"aggregations":{
"manufacturerKeys":{
"doc_count_error_upper_bound":0,
"sum_other_doc_count":0,
"buckets":[
{
"key":"8085",
"doc_count":27,
"top_manufacturer":{
"hits":{
"total":27,
"max_score":6.262597,
"hits":[
{
"_index":"manufacturer-autocomplete-v5.1.3",
"_type":"manufacturer",
"_id":"0000008085000000002000000004490101",
"_score":6.262597,
"_source":{
"manufacturerKey":8085,
"manufacturerName":"COMPANY1"
}
}
]
}
}
},
{
"key":"8084",
"doc_count":4,
"top_manufacturer":{
"hits":{
"total":4,
"max_score":6.262597,
"hits":[
{
"_index":"manufacturer-autocomplete-v5.1.3",
"_type":"manufacturer",
"_id":"0000008084000000002000000005840101",
"_score":6.262597,
"_source":{
"manufacturerKey":8084,
"manufacturerName":"COMPANY2"
}
}
]
}
}
}
]
}
}
}
Error Messages
2016-12-22 02:33:47,285 [http-bio-443-exec-11] [ STANDARD] [ ] [ DLLCOrig:02.01] ( engine.internal.ServiceHelper) WARN [email protected] - The reference _index is not valid. Reason: invalid property name: '_index', update "@baseclass.pyInboundIdentifierEncoder" and "@baseclass.pyOutboundIdentifierDecoder" decision tables to replace the invalid character in the incoming request data.
Steps to Reproduce
- Create a connect request with sample request and response in JSON format.
- Invoke the data page calling the JSON connector. The response mapping fails with the error message.
Root Cause
A defect in Pegasystems’ code or rules is identified as root cause of the issue.
The generated response data model for the provided response JSON created two pagelist properties within the same class hierarchy and both the properties had same pzExternalName causing the mapping to fail.
The sample JSON response has two pagelist properties with same name and present in same hierarchy.
One pagelist property is present with empty structure and other pagelist property is present with some properties.
Per current design, Pega code treats both of them as separate pagelist properties while generating the response data model.
One cannot have property with same name in same hierarchy in JSON. Ideally, there should be a schema to validate the generated JSON.
Resolution
Perform the following local-change:
Withdraw one of the pagelist properties causing the issue for the mapping to happen successfully.
Published January 10, 2017 - 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.