java.lang.ClassCastException: com.vordel.mime.RawBody cannot be cast to com.vordel.mime.JSONBody (Doc ID 2057981.1)

Last updated on OCTOBER 05, 2016

Applies to:

Oracle API Gateway - Version 11.1.2 and later
Information in this document applies to any platform.

Symptoms

A policy in OAG 11.1.2.3 (WS/SOAP Service) creates an external call to a REST Service that returns a JSON formatted message.  The policy should process the returned JSON Message and convert it to a XML message that serves as a response to the initial caller.

After the connection filter (to the REST service), a Trace Filter was placed to verify the contents of the variable content.body.  The Trace Filter will expose whether or not the message content is a valid JSON message, which it is in this test:

content.body {
DEBUG new buffered content stream 0x7f316fe90b50
DEBUG delete buffered content stream 0x7f316fe90b50 0x7f316f262b20
DEBUG Value: {"code":1,"message":"Lead successfully created","data":{"user_id":4013}}
DEBUG Type: com.vordel.mime.RawBody
DEBUG }

However the JSON to XML Filter fails with the following message:

java exception:
java.io.IOException: No JSON body found
...
Caused by: java.lang.ClassCastException: com.vordel.mime.RawBody cannot be cast to com.vordel.mime.JSONBody

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms