Receive Xml over REST

2902
1
02-19-2016 08:21 AM
New Contributor III

Hi I would like to receive following Xml over REST in GeoEvent

<?xml version="1.0" encoding="UTF-8"?>

<ez_data>

<fz title="First Test" id="abc55">

<updated timestamp="2016-02-12T22:59:59Z"/>

<pos x="52.30" y="-13.02"/>

<Statuslist>

<Assetstatus Status="NORMAL" type="A"/>

<Assetstatus Status="NORMAL" type="C"/>

<Assetstatus Status="NORMAL" type="C"/>

<Assetstatus Status="ABNORMAL" type="B"/>

<Assetstatus Status="ABNORMAL" type="C"/>

</Statuslist>

</fz>

</ez_data>

I would like to generate a new field using a defined logic by looking at the values of status and type in the list

e.g. if status="ABNORMAL" and type = "B", then new field= "MAJOR"

Is this feasible using any processor in GeoEvent ?

Tags (2)
Reply
0 Kudos
1 Reply
Esri Regular Contributor

Hello Rao –

Yes, the XML sample you provided above can easily be adapted by the product’s XML adapter and processed by a GeoEvent Service.

The first remark I have is that XML is translated to JSON by the product’s adapter.  So you will want to avoid using XML attributes which can contend with sub-elements of a given node. Your data sample is pretty clean, but to illustrate, this is what it looks like as JSON:

Capture.png

Your challenge, using GeoEvent, will be that you want to access items in a list which is part of a larger structure. If you were to stipulate that the list <Assetstatus> would always have exactly 5 items, then we could assume that you could pull specific items out by index. For example:

ez_data.fz.Statuslist.Assetstatus[3].Status

This isn’t normally something that you can stipulate and we cannot therefore assume there will be a fixed number of items in the list. In that case you have one opportunity – as part of the GeoEvent input’s configuration – to tell the adapter that it should use something other than <ez_data> as the root node.

You specify this using the XML Object Name parameter:

Capture2.png

This way, the five items in your sample XML’s <Assetstatus> list are each brought in as separate events. The upside is that you don’t need to worry about how many items will be in the list. The downside is you do not have the title, id, timestamp, or coordinate information that is above the <Assetstatus> node in the data structure.

There is work you can do to pull information from a XML feed’s header and incorporate it into individual event records. Please refer to the thread XML can I use this source if you are interested in taking that approach.

Hope this information is helpful -
RJ

Reply
0 Kudos