4 Replies Latest reply on Jun 8, 2011 9:07 AM by Daniel Pride

    Casting XML to ArrayCollection where only one record exists

    Daniel Pride Level 1

      I am working with web services and in the result handler doing the following

       

              protected function WbSc_SSPr_PrinterListResult_resultHandler(event:ResultEvent):void
                  {
                      printerlistArrayCollection =  event.result.Printer as ArrayCollection;
                      PrinterCount = printerlistArrayCollection.length-1;
                  }

      If there is more than one value returned it works fine.

      If only one value is returned then it shows as nothing.

      Eh?

       

      When i run it as a test it does return one record

       

      <?xml version="1.0" encoding="UTF-8"?>
      <SOAP-ENV:Envelope
        SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <SOAP-ENV:Body>
          <ns1:WbSc_SSPr_PrinterListResponse xmlns:ns1="http://www.4d.com/namespace/default">
            <BidList xsi:type="xsd:anyType">
              <Printer>
                <Make>Cognititve</Make>
                <Model>ZB345</Model>
                <Problem>THIS IS A TEST PROBLEM</Problem>
              </Printer>
            </BidList>
          </ns1:WbSc_SSPr_PrinterListResponse>
        </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>