Hope that helps In my Citrus test, I’m trying to validate an XML message that is embedded in a JSON document (the output of WireMock). The XML text needs to be parsed because it contains timestamps I want to ignore. The XML part of the JSON message looks like this: , Clarifications I have two remarks on your current solution:
With these it helps You are sending an empty message payload and this is why the JSONParser is running into errors. Do not apply the data dictionary on an empty message payload. The data dictionary is only able to overwrite given JSON message elements before send operation takes place.
it fixes the issue The payload is a JSON array of Strings. You are able to access a value in that array using JsonPath expression and extractFromPayload method. After extracting the whole value as a test variable using JsonPath you may use a Citrus function like citrus:substring()or citrus:substringAfter() in a second operation.
hope this fix your issue It would seem that the Citrus "functions" embedded in the JSON were not the problem. The problem was that I was not setting the Accept and Content-Type headers in the message the service was POSTing for the Citrus receive call. Since the receive call was set up to look for message type application/json, it was failing because my message had no headers at all (this is my impression). The Citrus call:
// Set route generator to receive and validate generate route command.
runner.http(builder -> builder