I am trying to call a java method with Argument (ArrayList<Object>) with a payload return from procedure call in cursor variable . but when I am hitting the application it is throwing Error.
This is the below Function call from connector:
Input to the function coming from DB procedure call will look like below but the type will be org.mule.runtime.internal.streaming.bytes.ManagedCursorStreamProvider
which we are passing to the Function due to which its throwing error.
[{
"AC":"123",
"mfaAcc": "3321",
"mstAccN": "111",
"cdaF": true
},
{
"AC":"443",
"mfaAcc":"3322",
"mstAccN": "222",
"cdaF": false
},
{
"AC":"6753",
"mfaAcc": "111",
"mstAccN": null,
"cdaF": true
}]
Error : Expected arguments are [java.util.ArrayList] but invocation was attempted with org.mule.runtime.internal.streaming.bytes.ManagedCursorStreamProvider argument type mismatch.
Can someone please help how can i converts org.mule.runtime.internal.streaming.bytes.ManagedCursorStreamProvider to Array of Objects so the Function accepts the input .
Hi @Rizwan Shaikh ,
I remember that I face something similar, did you try creating the correct type with a DW transformation before the Java call?
With something like this, using the class property ( https://docs.mulesoft.com/dataweave/latest/dataweave-types-coercion#properties-for-type-coercion) :
%dw 2.0
output application/dw
---
payload as Object {class: "my.target.class"}
And, you can also make a java call using the info of the following link:
https://docs.mulesoft.com/dataweave/latest/dataweave-cookbook-java-methods
In some use cases that was useful for me.
Hope it helps.
Good luck!
Juan Cruz Basso