"Object reference not set to an instance of an object." XMLtoRecordList ERROR

I was able to successfully make a SOAP request using ArdoHTTP. Now I want to display the XML data property one by one in my webscreen.

I'm encountering a problem when using Serialization_XmlToRecordList. There's no error when I compile/publish. But when I try to display the Xml data to my Web Screen it says 

"Object reference not set to an instance of an object."

Is there a bug or am I just not using it properly?

As of now, I'm trying to convert the XML response to JSON to avoid the RUNTIME ERROR.

I have to state that inside Serialization_XmlToRecordList, I am using ToObject(XMLResponse) to convert the XML response to Object.

Hi Helios,

Can you look at the error stack for this error in Service Center and post the result here, so we can have a better idea where the error originates?

Kilian Hekhuis wrote:

Hi Helios,

Can you look at the error stack for this error in Service Center and post the result here, so we can have a better idea where the error originates?

Hello, this is the error as seen in the Monitoring from Service Center:


Object reference not set to an instance of an object.
   at OutSystems.NssXml.CssXml.MssSerialization_XmlToRecordList(String ssXml, Object ssRecordList)
   at ssSQ_ServiceRequest.RssExtensionXml.MssSerialization_XmlToRecordList(HeContext heContext, String inParamXml, Object inParamRecordList)


 I think this is happening because of this line ToObject(XMLResponse) which doesn't cause errors in compile time, only in Runtime.

Mmm, that's unfortunately not too informative. Can you share an example eSpace + XML that exhibits this behaviour?

Kilian Hekhuis wrote:

Mmm, that's unfortunately not too informative. Can you share an example eSpace + XML that exhibits this behaviour?


Is Serialization_XmlToRecordList designed to parse a variable holding two structures or does it only accept one? This is what ToObject(ParseXMLResponse) look like:

My problem seems similar to the ones here:
https://www.outsystems.com/forums/forum_topicview.aspx?topicid=6151&topicname=discussion&

If this still doesn't make sense , I'll upload a sample of my .oml file. Thank you Kilian.

Well, regardless of whether that's possible (I'm not sure), it shouldn't crash :). If you could share an OML that would be great for bugtracking.

Kilian Hekhuis wrote:

Well, regardless of whether that's possible (I'm not sure), it shouldn't crash :). If you could share an OML that would be great for bugtracking.

I dont know how I can do this without exposing client details as I'm making calls to client IP in SOAP using ardoHTTP.

 Is there an alternative to Serialization_XmlToRecordList?  All them XMLtoRecord samples are outdated.

How bout I convert it JSON instead? Dont know how to navigate from there.

Hi Helios,

It's difficult to advise the best course of action without knowing the backstory here. I have many questions, but I think they're out of scope for this specific topic. If you can't provide some XML that exhibits the behaviour you are experiencing (and if I don't have the Structure definitions), I'm afraid there's little more I can do.

Kilian Hekhuis wrote:

Hi Helios,

It's difficult to advise the best course of action without knowing the backstory here. I have many questions, but I think they're out of scope for this specific topic. If you can't provide some XML that exhibits the behaviour you are experiencing (and if I don't have the Structure definitions), I'm afraid there's little more I can do.

Here's what my XML REQUEST looks like:


<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soap:Body>
    <RetrieveRoutesByCriteria xmlns="http://www.roadnet.com/RTS/TransportationSuite/TransportationWebService">
      <criteria>
        <regionID> VALUE_HERE </regionID>
        <routeDate>VALUE_HERE </routeDate>
        <driverIdentity>
          <regionID>VALUE_HERE </regionID>
          <employeeID>VALUE_HERE </employeeID>
        </driverIdentity>
      </criteria>
      <options>
        <level>VALUE_HERE </level>
        <retrieveContainers>VALUE_HERE </retrieveContainers>
        <retrieveFinancialInformation>VALUE_HERE </retrieveFinancialInformation>
        <retrieveDriverAlerts>VALUE_HERE </retrieveDriverAlerts>
        <retrieveActivities>VALUE_HERE </retrieveActivities>
        <retrieveRolledUpQuantities>VALUE_HERE </retrieveRolledUpQuantities>
        <retrieveSurveyAssignments>VALUE_HERE </retrieveSurveyAssignments>
        <timeZoneOptions>
          <embeddedInTimestamp>VALUE_HERE </embeddedInTimestamp>
          <optionType>VALUE_HERE </optionType>
          <timeZone>VALUE_HERE </timeZone>
        </timeZoneOptions>
      </options>
    </RetrieveRoutesByCriteria>
  </soap:Body>
</soap:Envelope>

Here's what my RESPONSE looks like:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://www.roadnet.com/RTS/TransportationSuite/TransportationWebService">
  <SOAP-ENV:Body>
    <ns1:RetrieveRoutesByCriteriaResponse>
      <ns1:routes>
        <ns1:routeIdentity xsi:type="ns1:RouteIdentity">
          <ns1:regionID>VALUE_HERE</ns1:regionID>
          <ns1:routeDate>VALUE_HERE</ns1:routeDate>
          <ns1:routeID>VALUE_HERE</ns1:routeID>
        </ns1:routeIdentity>
        <ns1:description>VALUE_HERE</ns1:description>
        <ns1:internalRouteID>VALUE_HERE</ns1:internalRouteID>
        <ns1:assigned>VALUE_HERE</ns1:assigned>
        <ns1:outOfSequence>VALUE_HERE</ns1:outOfSequence>
        <ns1:seal/>
        <ns1:plannedDistance>VALUE_HERE</ns1:plannedDistance>
        <ns1:projectedDistance>VALUE_HERE</ns1:projectedDistance>
        <ns1:actualDistance>VALUE_HERE</ns1:actualDistance>
        <ns1:plannedStart>VALUE_HERE</ns1:plannedStart>
        <ns1:plannedOriginDeparture>VALUE_HERE</ns1:plannedOriginDeparture>
        <ns1:plannedDestinationArrival>VALUE_HERE</ns1:plannedDestinationArrival>
        <ns1:plannedComplete>VALUE_HERE</ns1:plannedComplete>
        <ns1:projectedOriginDeparture>VALUE_HERE</ns1:projectedOriginDeparture>
        <ns1:actualStart>VALUE_HERE</ns1:actualStart>
        <ns1:actualOriginDeparture>VALUE_HERE</ns1:actualOriginDeparture>
        <ns1:actualDestinationArrival>VALUE_HERE</ns1:actualDestinationArrival>
        <ns1:actualComplete> VALUE_HERE </ns1:actualComplete>
        <ns1:routeStartTimeQuality> VALUE_HERE </ns1:routeStartTimeQuality>
        <ns1:originDepartTimeQuality> VALUE_HERE </ns1:originDepartTimeQuality>
        <ns1:destinationArrivalTimeQuality> VALUE_HERE </ns1:destinationArrivalTimeQuality>
        <ns1:routeCompleteTimeQuality> VALUE_HERE </ns1:routeCompleteTimeQuality>
        <ns1:plannedCost> VALUE_HERE </ns1:plannedCost>
        <ns1:actualCost> VALUE_HERE </ns1:actualCost>
        <ns1:dispatcherID> VALUE_HERE </ns1:dispatcherID>
        <ns1:group/>
        <ns1:scenario> VALUE_HERE </ns1:scenario>
        <ns1:wirelessLoaded> VALUE_HERE </ns1:wirelessLoaded>
        <ns1:wirelessProvider> VALUE_HERE </ns1:wirelessProvider>
        <ns1:wirelessID> VALUE_HERE </ns1:wirelessID>
        <ns1:inProgress> VALUE_HERE </ns1:inProgress>
        <ns1:complete> VALUE_HERE </ns1:complete>
        <ns1:gpsUnitID/>
        <ns1:lastInboundMessageId> VALUE_HERE </ns1:lastInboundMessageId>
        <ns1:startingLoadType> VALUE_HERE </ns1:startingLoadType>
        <ns1:numberOfStops> VALUE_HERE </ns1:numberOfStops>
        <ns1:numberOfStopsDelivered> VALUE_HERE </ns1:numberOfStopsDelivered>
        <ns1:numberOfStopsCancelled> VALUE_HERE </ns1:numberOfStopsCancelled>
        <ns1:positionText> VALUE_HERE </ns1:positionText>
        <ns1:positionLatitude> VALUE_HERE </ns1:positionLatitude>
        <ns1:positionLongitude> VALUE_HERE </ns1:positionLongitude>
        <ns1:delayMinutes> VALUE_HERE </ns1:delayMinutes>
        <ns1:delayType/>
        <ns1:postDelayMinutes> VALUE_HERE </ns1:postDelayMinutes>
        <ns1:postDelayType/>
        <ns1:status/>
        <ns1:routeType> VALUE_HERE </ns1:routeType>
        <ns1:lastStopIsDestination> VALUE_HERE </ns1:lastStopIsDestination>
        <ns1:origin xsi:type="ns1:LocationIdentity">
          <ns1:regionID> VALUE_HERE </ns1:regionID>
          <ns1:locationType> VALUE_HERE </ns1:locationType>
          <ns1:locationID> VALUE_HERE </ns1:locationID>
        </ns1:origin>
        <ns1:destination xsi:type="ns1:LocationIdentity">
          <ns1:regionID> VALUE_HERE </ns1:regionID>
          <ns1:locationType> VALUE_HERE </ns1:locationType>
          <ns1:locationID> VALUE_HERE </ns1:locationID>
        </ns1:destination>
        <ns1:originTimeZone> VALUE_HERE </ns1:originTimeZone>
        <ns1:destinationTimeZone> VALUE_HERE </ns1:destinationTimeZone>
        <ns1:userDefinedField1/>
        <ns1:userDefinedField2/>
        <ns1:userDefinedField3/>
        <ns1:userDefinedField4/>
        <ns1:userDefinedField5/>
        <ns1:userDefinedField6/>
        <ns1:color> VALUE_HERE </ns1:color>
        <ns1:isDeliveryRoute> VALUE_HERE </ns1:isDeliveryRoute>
        <ns1:helper> VALUE_HERE </ns1:helper>
        <ns1:driver1Name> VALUE_HERE </ns1:driver1Name>
        <ns1:driver2Name/>
        <ns1:preRouteSurveyIdentities>
          <ns1:id> VALUE_HERE </ns1:id>
        </ns1:preRouteSurveyIdentities>
        <ns1:reportedDistance> VALUE_HERE </ns1:reportedDistance>
        <ns1:reportedDistanceNote/>
        <ns1:preRouteSurveyIdentity>
          <ns1:id> VALUE_HERE </ns1:id>
        </ns1:preRouteSurveyIdentity>
        <ns1:lastContactTime> VALUE_HERE </ns1:lastContactTime>
      </ns1:routes>
    </ns1:RetrieveRoutesByCriteriaResponse>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Here's what the Structure looks like: I'm only using RouteCriteria and RouteInfoRetrieveOptions

An in-depth look at their sub-elements:

RouteCriteria

RouteInfoRetrieveOptions

Hence my ParseXMLResponse variable looks like:

which is used in:

What I want to do?
Be able to display properties I want on Web Screen like : regionID, regionDate, routeID , etc individually like:
"The date today is " + ParseXMLResponse.regionDate

Kilian Hekhuis wrote:

Hi Helios,

It's difficult to advise the best course of action without knowing the backstory here. I have many questions, but I think they're out of scope for this specific topic. If you can't provide some XML that exhibits the behaviour you are experiencing (and if I don't have the Structure definitions), I'm afraid there's little more I can do.

based on my answer above , did I use Serialization_XmlToRecordList properly?

I'm not entirely sure, I'm gonna check and get back to you (probably tomorrow).

Kilian Hekhuis wrote:

I'm not entirely sure, I'm gonna check and get back to you (probably tomorrow).

Hello Kilian. Are you able to use Serialization_XmlToRecordList seamlessly? Anything I might be missing?

Hi Helios,

Apologies for getting back so late, I've been busy. I must also apologies for confusing what you used, the Xml Extension, with what I thought you were using, the XML Records Extension.

The Xml Extension's Serialization_RecordListToXml and Serialization_XmlToRecordList are rather limited, and inconsistent, in the way they work. They are, however, only useful for serializing and deserializing OutSystems Lists back and forth (and, in case of Serialization_XmlToRecordList, need a Record List to function (as opposed to a List)). Also, they only work correctly with a Record List containing a single Entity or Structure.

So you should either use the XmlDocument_Load Action and the other Actions available in the Xml Extension, or give the XML Records Extension a try.

Kilian Hekhuis wrote:

Hi Helios,

Apologies for getting back so late, I've been busy. I must also apologies for confusing what you used, the Xml Extension, with what I thought you were using, the XML Records Extension.

The Xml Extension's Serialization_RecordListToXml and Serialization_XmlToRecordList are rather limited, and inconsistent, in the way they work. They are, however, only useful for serializing and deserializing OutSystems Lists back and forth (and, in case of Serialization_XmlToRecordList, need a Record List to function (as opposed to a List)). Also, they only work correctly with a Record List containing a single Entity or Structure.

So you should either use the XmlDocument_Load Action and the other Actions available in the Xml Extension, or give the XML Records Extension a try.

Thanks for clarifying this that we've been referring to 2 different components. I'll look into this and will keep you updated. Thanks for taking the time to look into this despite your busy sched.