IO Mapping to simplify complex responses not working

I am using the newest version of the Zeebe HTTP worker to invoke existing endpoints. We do not control these endpoints so have to deal with the complex structure of data returned.

The Zeebe HTTP worker puts the response of service in a variable called “body”. I am attempting to define a mapping which will take the response from variable “body” and output this into a new variable as follows:

Output mappings:

  1. source: body, target:someComplexResponseModel
  2. source: target:someComplexResponseModel.map.data.map , target: simplierResponseModel

With these definitions, I get the following incident:

No data found for query target:someComplexResponseModel.map.data.map.

Even though the JSON returned from the service does conform to the structure above.

A couple of questions:

  1. Could someone please help me understand what is going on here? I am using a two step process to clarify intent.
  2. After these mappings have been performed, I am still expected to see the content of “body” in the workflow instance variable stack? Specifically, if this instance of “body” was used as output mapping, should I still be expect to see the exact value in the variable stack?

Hi @klaus.nji,

I’m sorry but I have problems to follow your problem. Please discuss the behavior with your concrete example.

Which JSON does the HTTP service returns?
Which variables are returned by the worker?
What output and input mappings are defined on the task?
Which variables do you expect in the workflow instance?

Best regards,
Philipp

1 Like

@philipp.ossler, thanks for responding.

I cannot share the internals of the JSON returned but the snapshot posted above gives the overall structure. The worker returns the correct JSON but the failure is happening during mapping.
I have been able to get around the error with this change to the output mapping:

 <zeebe:ioMapping>
            <zeebe:output source="body.map.data.map" target="orgCreationProgressResponseData" />
          </zeebe:ioMapping>

If instead I did this:

 <zeebe:ioMapping>
            <zeebe:output source="body" target="orgCreationProgressResponse" />
            <zeebe:output source="orgCreationProgressResponse.map.data.map" target="orgCreationProgressResponseData" />
          </zeebe:ioMapping>

I experience the error “No data found for query orgCreationProgressResponse.map.data.map.”

This deals with the first question. The second question is still pending though:

If I have a mapping like this:

 <zeebe:ioMapping>
            <zeebe:output source="body" target="orgCreationProgressResponseData" />
          </zeebe:ioMapping>

What does Zeebe do with the original data variable called body? Does it discard this?

This mapping does not work because the source does not reference a variable from the job complete command. It is not possible to use a variable that is created by a previous target mapping.

Yes. If the task has an output mapping then only the defined variables are propagated. The other variables are discarded.

Please have a look at the docs: Zeebe | Camunda 8 Docs

Does this help you?

Ah… think I got that now:

This mapping does not work because the source does not reference a variable from the job complete command

The mapping

  <zeebe:output source="orgCreationProgressResponse.map.data.map" target="orgCreationProgressResponseData" />

The http task returned a statusCode and a body as variables and not orgCreationProgressResponse.map.data.map .

I was thinking that the first mapping

<zeebe:output source="body" target="orgCreationProgressResponse" />

Would create this new variable called orgCreationProgressResponse and make this available to the second mapping.

Now I wonder how this was working before the changes.

Thanks for clarifying.

1 Like