Question
Handle exception when calling 'Connect-REST'
Hello,
I have an activity calling a Connector whose HTTP Method is GET via the activity method 'Connect-REST'.
It might happen that the service returns an HTTP Sttaus of 500/503.
In this case, before the end of the method 'Connect-REST', an exception gets thrown in the predefined activity pyInvokeRESTConnector CL: Rule-Connect-REST RS:Pega-IntegrationEngine:07-10-23 with the following exception trace:
com.pega.pegarules.pub.services.InboundMappingException: Error mapping incoming response to .Response.response_GET: org.codehaus.jackson.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at [Source: java.io.StringReader@4f0f4729; line: 1, column: 2] |
and the processing of the rest of the activity stops.
Any ideas on how to handle a return the exception thrown by the activity pyInvokeRESTConnector ?
Thank you,
Mariane
***Updated by Moderator: Marissa: Moved from Pega Academy to Product Support Community, updated categories***
I am not very sure about exception handling in CONNECT-REST but I also faced similer exception.
In my case it was due to different type of response format. Expected format was JSON but received response was of XML format.
This error could be due to xml response and your connect-rest response mapping configured for JSON. Try to get JSON output from source or else change the response mapping to accept xml output(by using parse xml rule).