cancel
Showing results for 
Search instead for 
Did you mean: 

java.util.ArrayList cannot be cast to java.util.HashMap - occurred while responding back to client

ananda_paul
Explorer
0 Kudos

Hi All,

I am implementing the oData service in CPI that consumes SOAP web service in ByDesign. From Postman, I can call the oData service that internally calls the SOAP service and the response is mapped to oData data model. I have logged the response in CPI, but it errors out at the last step with the message java.util.ArrayList cannot be cast to java.util.HashMap. From the error, I understand that the the output generated from CPI is of ArrayList type, but when the response goes back to client, the conversion happens internally and the destination type is HashMap. As the source and destination object types are different, it errors out. Is there something wrong with oData data model? How does the internal conversion work?

I have attached the data model EDMX file and WSDL file for reference. Also attached sample input and output messages to the oData service in CPI and the response mapping. Please guide me to fix this issue.

querysitelogisticstaskwsdl.txt

odata-datamodeledmx.txt

input-message-to-odata-service.txt

output-message-from-odata-service.txt

response-mapping.png

Accepted Solutions (1)

Accepted Solutions (1)

ananda_paul
Explorer
0 Kudos

It is working now after checking with my colleague who make me understand oData concept. I was actually firing the oData GET request asking for a particular record, meaning oData was expecting only one record. But I developed the flow to return more than one record, which oData framework did not like. That is the root cause of the issue. When I changed the query to return multiple like adding $top or $skip, the same oData service without any modifications worked returning more than one records.

0 Kudos

Hi ananda.paul,

I am facing similar issue. My client asked to return 2 records for same employee when some condition met. When I am trying to send 2 records seperately with splitter, it's not giving error as below.

java.lang.ClassCastException: java.util.ArrayList (loaded by <bootstrap>) cannot be cast to java.util.HashMap (loaded by <bootstrap>)

Could you please help me, how to query to get the 2 records.

My current query is like below

https://XXXXXX/gw/odata/SAP/ODATA_TESTING;v=1/PerPersonSet('hari.shankar@xyz.com')

Answers (0)