views:

230

answers:

1

I am currently consuming a WSDL in Flex, that is on the back-end served by .NET. ALL of the operations seem to work fine, except one, whose result object is not being properly parsed by AS3 for some odd reason. I have inspected the response XML in Fiddler/Charles and the data is there, but in NOT in the result in the Flex variable inspector. The culprit is the sub-tag 'DD' (result.data.result.Tables.DD.Columns) I only see one of them and it's 17 sub-tag children, but they are listed as array indices 0-17 with a values of "RID", "NP", "LI" and so on. But those tags have NO values. I think I'm not getting any of the <DD> tags.

Here is my result handler:

public function getLocationStats_result( result : Object ) : void
{
   trace("Location Stats Received");
   var locations : ArrayCollection = result.data.result.Tables.DD.Columns;

   sublocationCheck();
   for(var i: int =0; i < locations.length; i++)
   {
      //Setting up the info Dictionary, key= location name, value =  LocationInfo obj.
      model.pinLocations.sublocations.getItemAt(0).info[locations[i]]= new LocationInfo();
   } 
};  

And here is the relevant portion of the response from the WSDL:

<GetLocationStatsResponse xmlns="http://tempuri.org/"&gt;
  <GetLocationStatsResult>
    <xs:schema id="Rpt_DSDashBoardFeed" targetNamespace="http://tempuri.org/Rpt_DSDashBoardFeed.xsd" xmlns:mstns="http://tempuri.org/Rpt_DSDashBoardFeed.xsd" xmlns="http://tempuri.org/Rpt_DSDashBoardFeed.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" attributeFormDefault="qualified" elementFormDefault="qualified">
      <xs:element name="Rpt_DSDashBoardFeed" msdata:IsDataSet="true">
        <xs:complexType>
          <xs:choice maxOccurs="unbounded">
            <xs:element name="DD">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="RID" type="xs:decimal" minOccurs="0" />
                  <xs:element name="LP" type="xs:long" minOccurs="0" />
                  <xs:element name="NI" type="xs:long" minOccurs="0" />
                  <xs:element name="ENC" type="xs:long" minOccurs="0" />
                  <xs:element name="IMIN" type="xs:dateTime" minOccurs="0" />
                  <xs:element name="IMAX" type="xs:dateTime" minOccurs="0" />
                  <xs:element name="CC" type="xs:string" minOccurs="0" />
                  <xs:element name="LC" type="xs:string" minOccurs="0" />
                  <xs:element name="SLC" type="xs:string" minOccurs="0" />
                  <xs:element name="PC" type="xs:string" minOccurs="0" />
                  <xs:element name="CN" type="xs:string" minOccurs="0" />
                  <xs:element name="LN" type="xs:string" minOccurs="0" />
                  <xs:element name="SLN" type="xs:string" minOccurs="0" />
                  <xs:element name="PN" type="xs:string" minOccurs="0" />
                  <xs:element name="HW" type="xs:decimal" minOccurs="0" />
                  <xs:element name="TH" type="xs:decimal" minOccurs="0" />
                  <xs:element name="TE" type="xs:decimal" minOccurs="0" />
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:choice>
        </xs:complexType>
      </xs:element>
    </xs:schema>
    <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
      <Rpt_DSDashBoardFeed xmlns="http://tempuri.org/Rpt_DSDashBoardFeed.xsd"&gt;
        <DD diffgr:id="DD1" msdata:rowOrder="0" diffgr:hasChanges="inserted">
          <RID>21389325</RID>
          <LP>277467563</LP>
          <NI>1</NI>
          <ENC>1</ENC>
          <IMIN>2010-02-16T09:53:54.0000000-05:00</IMIN>
          <IMAX>2010-02-16T09:53:54.0000000-05:00</IMAX>
          <CC>WDWPR</CC>
          <LC>MK</LC>
          <SLC>ENTR</SLC>
          <PC>397850</PC>
          <CN>Some String</CN>
          <LN>Another String</LN>
          <SLN>Location</SLN>
          <PN>Eastman, Suzy</PN>
          <HW>0</HW>
          <TH>11</TH>
          <TE>30</TE>
        </DD>
        <DD diffgr:id="DD2" msdata:rowOrder="1" diffgr:hasChanges="inserted">
          <RID>21389326</RID>
          <LP>277467508</LP>
          <NI>8</NI>
          <ENC>2</ENC>
          <IMIN>2010-02-16T09:53:42.0000000-05:00</IMIN>
          <IMAX>2010-02-16T09:55:16.0000000-05:00</IMAX>
          <CC>WDWPR</CC>
          <LC>MK</LC>
          <SLC>FMAIN</SLC>
          <PC>359800</PC>
          <CN>Some String</CN>
          <LN>Yet ANOTHER string</LN>
          <SLN>Some Info</SLN>
          <PN>Mays, Willie</PN>
          <HW>0</HW>
          <TH>11</TH>
          <TE>42</TE>
        </DD>

(Truncated, more DD tags follow, plus close tags.) All I see is the initial tag with the Tag names, I don't see in my debugger in the result object any of the actual DD tags or how to access them. How on earth do I reference them? I've gone crazy Googling around and searching stackoverflow for an answer, and now I am stuck. Thanks in advance for any help!

+1  A: 

Eureka! I figured it out.

Apparently, Flex can't handle a .NET DataSet object that's been serialized into a WSDL response. Instead, you must use Object Arrays on the .NET end for Flex to be able to parse it into your result object in Flex.

Another option is to just convert the DataSet into XML in .NET, which apparently, can easily be read by Flex/AS3. Yes, this is incredibly lame. Hello Adobe?

I picked up this answer over on Andrew Stopford's blog. (Thanks Andrew!)

AlanP