0 Replies Latest reply on Jun 8, 2007 5:35 PM by gryffin

    Problem marshalling data from a List

    gryffin

      I have a problem sending a list of item to a client.
      I send an object, which contains a member that itself stores a list of device objects. These objects store a member that is either a tag or a network device. ( I don't get to define the WSDL or Schema. )

      I confirm that my List object does store a collection of devices which each in turn have a tag.

       13:58:54,126 DEBUG [AssociationValuesDAO] Device.deviceList:
       [com.boeing.nmt.types.DeviceData$Device$AeroScoutTag@18a5d49,
       com.boeing.nmt.types.DeviceData$Device$AeroScoutTag@f2a0ef,
       com.boeing.nmt.types.DeviceData$Device$AeroScoutTag@123b9c1,
       com.boeing.nmt.types.DeviceData$Device$AeroScoutTag@786e16,
       com.boeing.nmt.types.DeviceData$Device$AeroScoutTag@838143,
       com.boeing.nmt.types.DeviceData$Device$AeroScoutTag@19b7dfa,
       com.boeing.nmt.types.DeviceData$Device$AeroScoutTag@16bb63e,
       com.boeing.nmt.types.DeviceData$Device$AeroScoutTag@89e0c6,
       com.boeing.nmt.types.DeviceData$Device$AeroScoutTag@3fcfb]
      

      I send this across the wire ( server and client are local ). I unpack it and everything works great Until I try to access the tags inside the device objects in the List.

      They're NULL.
       [java] device list: [com.boeing.nmt.client.ws.DeviceData$Device@102a0a5, com.boeing.nmt.client.
      ws.DeviceData$Device@180b22e, com.boeing.nmt.client.ws.DeviceData$Device@31fb31, com.boeing.nmt.clie
      nt.ws.DeviceData$Device@162522b, com.boeing.nmt.client.ws.DeviceData$Device@89dd, com.boeing.nmt.cli
      ent.ws.DeviceData$Device@15b1773, com.boeing.nmt.client.ws.DeviceData$Device@160bf50, com.boeing.nmt
      .client.ws.DeviceData$Device@b05236, com.boeing.nmt.client.ws.DeviceData$Device@1e55794]
       [java] device list size: 9
       [java] dev[1]: com.boeing.nmt.client.ws.DeviceData$Device@102a0a5
       [java] Exception! java.lang.NullPointerException
      

      I trigger the exception this way:

       List <DeviceData.Device> devList = aagr.getAssociationValues().getDeviceData().getDevice();
       System.out.println("device list: " + devList.toString() );
       System.out.println("device list size: " + devList.size() );
       // devList.toArray()[0] is a DeviceData.Device.Tag object, for whatever reason, it's NULL
       System.out.println("dev[1]: " + devList.toArray()[0].toString());
       System.out.println("dev[1]: " + ((DeviceData.Device)devList.toArray()[0]).toString());
      


      I look back at the logs to see what JBoss is unmarshalling, and it looks fine.

      2007-06-08 13:58:54,158 DEBUG [org.jboss.ws.core.soap.ObjectContent] xmlFragment: [source=
      <Results xmlns:ns2="http://www.boeing.com/NLS/ns/Types" xmlns:ns3="http://www.boeing.com/NLS/ns/soapTypes" Version="0.3.0">
       <ns3:AssociationReturnCode>
       <ns3:Success>true</ns3:Success>
       <ns3:Reason>Dumb luck</ns3:Reason>
       </ns3:AssociationReturnCode>
       <ns3:AssociationValues DeleteOtherDeviceAssociations="false" CreateDeviceAssociations="NONE">
       <ns3:DeviceData Version="0.3.0">
       <ns2:Device xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:AeroScoutTag" MacId="000CCC654323">
       <ns2:BatteryStatus>Unknown
       </ns2:BatteryStatus>
       </ns2:Device>
       ...
       </ns3:DeviceData>
       <ns3:AssetData Version="0.3.0" OwnerAppId="foo" AssetId="fah">
       <ns2:AssetDisplayName>gah</ns2:AssetDisplayName>
       <ns2:AssetDescription>fah</ns2:AssetDescription>
       <ns2:AssetSuspended>true</ns2:AssetSuspended>
       </ns3:AssetData>
       </ns3:AssociationValues>
      </Results>
      ]
      2007-06-08 13:58:54,158 DEBUG [org.jboss.ws.core.soap.SOAPContentElement] -----------------------------------
      2007-06-08 13:58:54,220 DEBUG [org.jboss.ws.core.soap.MessageContextAssociation] popMessageContext: org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS@131a24c (Thread http-0.0.0.0-8080-2)


      I'm using JBoss 4.0.5 w/ JBossWS 1.2.0. Does anyone have an idea what am I missing?