I have a json response using the Http Client Adapter which has the below format
{
"?xml": {
"@version":"1.0",
"@encoding":"utf-8"
},
ArrayOfBusinessTypeAPI {
"@xmlns:xsd":"http://www.w3.org/2001/XMLSchema",
"@xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance",
...
}
}
I need some information on how the below elements can be defined in the event definition.
1.?xml
2.@version
3.@xmlns:xsd
As per the documentation "@" is used for substitution and : for coassignment. Can someone please provide any insight as to how this can be done.
I assume you mean in the yaml mapper codec, in which case you can simply quote the keys and this should work:
If you were asking how to declare an event in EPL to handle this response, you don't need to use the exact naming scheme in your event definition. You could have:
And then using the mapper codec map between the two fields like so:
EDIT
So the first thing stopping your event parsing is that your response isn't valid JSON. The line "ArrayOfBusinessTypeAPI {" would need to be ""ArrayOfBusinessTypeAPI": {". You can only use the mapper codec to parse JSON.
The second reason this isn't working is because the content type is set to text/html. Does the JSON codec have filterOnContentType set to true? If so, it won't transform this message.
However, if the JSON is valid and gets processed by the JSON codec, you can correctly map the event like so:
Which maps to an event: