AnsweredAssumed Answered

XML to GeoEvents (information as xml-attributes)

Question asked by Schlomm_1 on Oct 5, 2015
Latest reply on Jan 21, 2016 by rsunderman-esristaff

@

Dear all,

After working with JSON data, I am now in the situation, where I have to work with XML data using a running instance of ArcGIS Server/GeoEvent Processor 10.3.1.

Find below an XML-data example snippet:

 

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

<ez_data

    xmlns="http://tempuri.org/XML_Echtzeit.xsd" ksType="EPSG:4326">

    <fz snr="D74692" fk="9999">

        <ez timestamp="2015-08-19T07:20:07.0">

            <pos x="-97.121513" y="39.798685"/>

            <work id="5"></work>

        </ez>

    </fz>

    <fz snr="D73512" fk="9999">

        <ez timestamp="2015-08-14T14:29:43.0">

            <pos x="-97.121505" y="39.79869"/>

            <work id="5"></work>

        </ez>

    </fz>

    <fz snr="D73514" fk="9999">

        <ez timestamp="2015-08-17T06:24:23.0">

            <pos x="-97.121517" y="39.798703"/>

            <work id="3"></work>

        </ez>

    </fz>

    <fz snr="D73515" fk="9999">

        <ez timestamp="2015-08-17T05:28:47.0">

            <pos x="-97.121483" y="39.798687"/>

            <work id="3"></work>

        </ez>

    </fz>

    <fz snr="D73679" fk="9999">

        <ez timestamp="2015-08-17T07:19:34.0">

            <pos x="-97.121523" y="39.798702"/>

            <work id="5"></work>

        </ez>

    </fz>

    <fz snr="D73517" fk="9999">

        <ez timestamp="2015-08-17T05:53:40.0">

            <pos x="-97.121485" y="39.798688"/>

            <work id="5"></work>

        </ez>

    </fz>

    <fz snr="D73516" fk="9999">

        <ez timestamp="2015-08-17T11:02:54.0">

            <pos x="-97.121513" y="39.798698"/>

            <work id="3"></work>

        </ez> 

    </fz>

    <fz snr="D73510" fk="9999">

        <ez timestamp="2015-08-17T09:06:24.0">

            <pos x="-97.121507" y="39.798702"/>

            <work id="3"></work>

        </ez>

    </fz>

    <fz snr="D73508" fk="9999">

        <ez timestamp="2015-08-17T07:50:32.0">

            <pos x="-97.121507" y="39.798705"/>

            <work id="5"></work>

        </ez>

    </fz>

</ez_data>

 

For tesing purposes I have configured a "Receive XML on a REST Endpoint" input adapter. Later on I will poll an external website for the XML data...

The adapter is configured as the following:

inputAdapter.PNG

 

The genereated GeoEvent Defition is generated as the following. The position field is correctly identified as the GEOMETRY-Field, so I assume that I do not need to construct the Geometry-Field manually!?

GeoEventDefinition_generated.PNG

 

For tesing-purpose, I've created a GeoEvent Service, which uses the above mentioned input adapter. I use two output-adapters - one is writing the data to a csv file and another one creates a geojson-file.

Coming to my problem: The first and only the first time, the output looks correctly:

The CSV-Output, which is created, looks like the following:

XMLInput,9999,D74692,"{""work"":{""id"":5.0},""timestamp"":1439968807000,""pos"":""{\""x\"":-97.121513,\""y\"":39.798685}""}"

XMLInput,9999,D73512,"{""work"":{""id"":5.0},""timestamp"":1439562583000,""pos"":""{\""x\"":-97.121505,\""y\"":39.79869}""}"

XMLInput,9999,D73514,"{""work"":{""id"":3.0},""timestamp"":1439792663000,""pos"":""{\""x\"":-97.121517,\""y\"":39.798703}""}"

XMLInput,9999,D73679,"{""work"":{""id"":5.0},""timestamp"":1439795974000,""pos"":""{\""x\"":-97.121523,\""y\"":39.798702}""}"

XMLInput,9999,D73517,"{""work"":{""id"":5.0},""timestamp"":1439790820000,""pos"":""{\""x\"":-97.121485,\""y\"":39.798688}""}"

XMLInput,9999,D73515,"{""work"":{""id"":3.0},""timestamp"":1439789327000,""pos"":""{\""x\"":-97.121483,\""y\"":39.798687}""}"

XMLInput,9999,D73510,"{""work"":{""id"":3.0},""timestamp"":1439802384000,""pos"":""{\""x\"":-97.121507,\""y\"":39.798702}""}"

XMLInput,9999,D73516,"{""work"":{""id"":3.0},""timestamp"":1439809374000,""pos"":""{\""x\"":-97.121513,\""y\"":39.798698}""}"

XMLInput,9999,D73508,"{""work"":{""id"":5.0},""timestamp"":1439797832000,""pos"":""{\""x\"":-97.121507,\""y\"":39.798705}""}"

 

Also the geojson-file is created including the geometry field, so I would be able to visualize the data on geojson.io.

Check the output here: [JSON] geojson-output - Pastebin.com

 

 

Now, when I push the the above mentioned XML-data again to my RestInput-Adapter, the geometry-field is not anymore recognized, so the output look like this:

XMLInput,9999,A54692,"{""work"":{""id"":5.0},""timestamp"":1439968807000}"

XMLInput,9999,A53515,"{""work"":{""id"":3.0},""timestamp"":1439789327000}"

XMLInput,9999,A53679,"{""work"":{""id"":5.0},""timestamp"":1439795974000}"

XMLInput,9999,A53512,"{""work"":{""id"":5.0},""timestamp"":1439562583000}"

XMLInput,9999,A53516,"{""work"":{""id"":3.0},""timestamp"":1439809374000}"

XMLInput,9999,A53510,"{""work"":{""id"":3.0},""timestamp"":1439802384000}"

XMLInput,9999,A53514,"{""work"":{""id"":3.0},""timestamp"":1439792663000}"

XMLInput,9999,A53517,"{""work"":{""id"":5.0},""timestamp"":1439790820000}"

XMLInput,9999,A53508,"{""work"":{""id"":5.0},""timestamp"":1439797832000}"

 

Also the geojson-output is not created correctly as the geometry-object is not generated anymore.

 

 

Coming to my questions:

Why my Workflow is only working for the very first time?

 

Would be awesome to get some feedback!

All the best,

Dominik

Outcomes