Http Worker Request Body

Hello,
I am using the http worker to communicate with my Rest Microservices. One of my services accepts a POST request with a JSON body. I tried to set the body variables in the headers using the zeebe modeler but it does not work. In the modeler there is no option to set Variables, the only options are Variable Mappings and Headers. How can I set the body of my request using the modeler ? Is it a variable mapping ? If so, how can I create an object like the following:
{
“property1”: “3fa85f64-5717-4562-b3fc-2c963f66afa6”,
“property2”: “ERR”,
“property3”: “PSBIOOri”
}
the properties are Workflow instance variables. I am using the zeebe modeler. I have already posted the issue in Github, but if someone has an idea, it can help

Thank you

You need to start a workflow instance and pass the variables in to it.

See here: https://github.com/creditsenseau/zeebe-client-node-js#start-a-workflow-instance if you are using the Node client. Here: https://docs.zeebe.io/java-client/get-started.html#create-a-workflow-instance for the Java client.

1 Like

I am already setting the variables via the .net client, but my workflow has many tasks and one of them is using the http worker to call a microservice. The inputs/outputs are coming from other steps/microservices and I need to format the input and generate the body for the POST request

@nizare can you link the issue in GitHub here for reference?
Usually, if you need manipulation of your data you do it in your worker.

@salaboy I have already opened an issue :slight_smile:


Actually I am able to set my body variable, but I am having another trouble. My server is rejecting the request with 400 BAD Request. I investigated the problem and identified that my request header has the key:
“”""
Connection Upgrade, HTTP2-Settings
“”""
That is why my server is rejecting the request. I am wondering if this key is set by the http worker or zeebe itself.
Thank you

The solution I finally adopted was to use a reverse proxy between my micro service and the the http worker. Actually the http worker sets the Connection header to Upgrade and for me the best solution was to reset the headers using my reverse proxy.

2 Likes