I’m trying to do a POST request using Http Task, but ResponseReason
is “Bad Request”, so it must be some problem with the body I think, but I don’t know what is.
In my HTTP Task in the UI modeler I’ve set this:
and in XML file I have this:
<flowable:field name="requestBody">
<flowable:expression><![CDATA[${body}]]></flowable:expression>
</flowable:field>
and in my application I’m passing the params this way (in Java):
@PostMapping(path = PathConstants.START_ACTION)
public ResponseEntity<BaseResponse<ProcessInstance>> start(@PathVariable String processDefinitionId,
@RequestBody(required = false) Map<String, Object> params)
where params is (testing it in postman):
{
"input":3,
"body": {
"email":"peter@klaven",
"password":"cityslicka"
}
}
and then runtimeService.startProcessInstanceById(processDefinitionId, params);
so I’m expecting that the body
variable is read correctly.
For further checking I’ve tried printing the body variable after starting process instance, and in fact I have this:
body={email=peter@klaven, password=cityslicka}
The error is saying that probably the body is malformed, right? So what am I doing wrong in passing/setting process variables?
EDIT
I’ve tried adding manually the body to the params Map this way:
params.put("body","{\"email\":\"peter@klaven\", \"password\":\"cityslicka\"}");
but the error is the same.