Support Article
Error on parsing REST Response
SA-37432
Summary
Calling a JSON REST service using Connect-Rest Rule. GET method works fine but PUT fails with error.
Error Messages
PegaRULES log shows:
HTTP Status code: 400 Bad Request
Tracer shows:
pyRawMessage
Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at [Source: org.jboss.resteasy.core.interception.MessageBodyReaderContextImpl$InputStreamWrapper@171476a8; line: 1, column: 2]
pyStatusValue Fail:
Unexpected HTTP 400 Response code
pyStatusMessage
the HTTP response code of 400 indicated a client error. The response data may contain a reason.
pyHTTPResponseCode
400
Steps to Reproduce
- Call a Rest service that returns JSON response
- Use Put method and try to map the response
Root Cause
A software use or operation error. Tracer output shows pyRequestData or "Request Message" in XML format which means JSON conversion of request Clipboard page hasn't been done. The default format used by Pega for mapping outbound Rest request is XML and not JSON. Since the end Rest Service expects a JSON message, it returns 400 Bad request error.
Resolution
Perform the following local-change: On Request tab of Put method of Connect-Rest Rule form, specify JSON as 'Map From'.
Published May 6, 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.