I am very new to the OutSystems Platform and am having a bit of an issue with parsing an XML file that I am getting as a response to a RESTful webservice call.  I can see that I am actually getting a good response fromt he web serivce, and using XMLDocument_selectSingleNode and passing that to XmlAttribute_GetValue, I can even see a single value.  The trouble comes because I want to pull all of the record from the XML (several hundred records) into a db table(ultimately).

The returned XML looks something like:

      <responseItem id="DVN" value="992010"></responseItem>
      <responseItem id="ActivityType" value="In Motion"></responseItem>
      <responseItem id="LastLatitude" value="43.59252"></responseItem>
      <responseItem id="LastLongitude" value="-111.137"></responseItem>
      <responseItem id="LastActivityDate" value="2013-01-17 20:43:50.0"></responseItem>
      <responseItem id="DVN" value="992011"></responseItem>
      <responseItem id="ActivityType" value="Device Unplugged"></responseItem>
      <responseItem id="LastLatitude" value="43.50984"></responseItem>
      <responseItem id="LastLongitude" value="-112.0052"></responseItem>
      <responseItem id="LastActivityDate" value="2012-05-08 17:25:10.0"></responseItem>
      <responseItem id="DVN" value="992012"> </responseItem>
      <responseItem id="ActivityType" value="Stopped"></responseItem>
      <responseItem id="LastLatitude" value="46.22679"></responseItem>
      <responseItem id="LastLongitude" value="-119.23491"></responseItem>
      <responseItem id="LastActivityDate" value="2013-01-17 18:57:59.0"></responseItem>

I am taking this XML, which is returned as text, pushing it through Regex_Replace to pull off the <webServiceResponse> and </webServiceResponse>.  I take the results of that and use that as the input to Serialization_XmlToRecordList.  I have a record list local variable that points to a structure called response, which has a single attribute called responseList and is of type record list.  The record definition is structure called responseList, which also has a single attribute called responseItem, which points to another structure called responseItem.  The responseItem structure has attributes Attr_DVN, Attr_Activity, Attr_Latitude, Attr_Longitude and Attr_ActivityDate.  When I run this I get an error that says "Object reference not set to an instance of an object.".  If I change this so that the <response> and </response> are removed and I use a record list local that points to the responseList structure I get an error message about multiple root elements.

My intention is to push all of this data into an entity and have it run as a timer so that I can report on the locaiton of the vehicles near real time.

Any assitance in helping me understand where I went wrong, or what I am missing would be greatly appreciated.


I have actually started with the XML Records extension, but cound not figure out how to build the structures to match the layout of the xml.