Hi guys,
I am trying to set an object as a process variable via the camunda REST-API when completing a task.
If I do this via Postman for a process instance running in the pre-packaged camunda for Wildfly, it works well. My body looks like this:
{“variables”: {“aVariable”: {“value”: “{"intfield":1,"doubleField":1.1}”,“type”:“Object”,“valueInfo”:{“objectTypeName”:“com.random.randomObject”,“serializationDataFormat”:“application/json”}}}}
I get an HTTP 204 response and can see the successfully set process variable in the cockpit:
However, in a test case I set up with Spring Boot (with camunda spring boot starter) I get the following Exception:
I get the same Exception in the call with Postman IF I don’t specify the serializationDataFormat to application/json. However, I clearly also include it within the REST call that produces the exception, since it’s set in the ObjectValue.
So i decided to debug a little bit and found out, that when camunda is looking for the correct serializer it goes for the “JavaObjectSerializer”:
When entering the canWriteValue function, it compares the serializationDataFormat (application/x-java-serialized-object) and the requestedDataFormat (application/json) and therefore returns false, which in the end leads to the exception above:
I think the correct Serializer would be the JsonValueSerializer.
My questions would be: Why does the Postman call with camunda running on JBOSS work, but the same call fails within a SpringBoot environement? Is there any way to fix this?
What’s also strange with postman is, that I can set any nonsense serializationDataFormat and it will still works:
If i change the type from “Object” to “String” it works, but that’s not what my intentions are.
Any help is highly appreciated!
Best Regards