1 Reply Latest reply on Aug 29, 2008 2:24 AM by Newsgroup_User

    Problem Consuming WS with e4x

    new2as&flex
      So, I am very new to Flex and AS so please help me out here. I am tring to consume the following basic webservice:

      <env:Envelope xmlns:env=" http://schemas.xmlsoap.org/soap/envelope/">
      <env:Header />
      <env:Body>
      <m:GetMetersResponse xmlns:m=" http://webservices">
      <m:return xmlns:java="java:webservices">
      <java:MeterData>
      <java:Address1>88888 THATTA WAY</java:Address1>
      <java:City>SHAVER LAKE</java:City>
      <java:Descr>Fresno</java:Descr>
      <java:ESS>0</java:ESS>
      <java:Feeder>888888888</java:Feeder>
      <java:Latitude>37.013576</java:Latitude>
      <java:Longitude>-118.977831</java:Longitude>
      <java:OpArea>TK</java:OpArea>
      <java:PREM_ID>8888888888</java:PREM_ID>
      <java:SP_ID>8888888888</java:SP_ID>
      <java:Transformer>888888888888</java:Transformer>
      <java:Zip>8888</java:Zip>
      </java:MeterData>
      <java:MeterData>
      <java:Address1>99999 THATTA WAY</java:Address1>
      <java:City>SHAVER LAKE</java:City>
      <java:Descr>Fresno</java:Descr>
      <java:ESS>0</java:ESS>
      <java:Feeder>999999999</java:Feeder>
      <java:Latitude>37.013576</java:Latitude>
      <java:Longitude>-118.977831</java:Longitude>
      <java:OpArea>TK</java:OpArea>
      <java:PREM_ID>9999999999</java:PREM_ID>
      <java:SP_ID>9999999999</java:SP_ID>
      <java:Transformer>999999999999</java:Transformer>
      <java:Zip>9999</java:Zip>
      </java:MeterData>
      </m:return>
      </m:GetMetersResponse>
      </env:Body>
      </env:Envelope>

      So, I am trying to do the following:

      private function loadMeterMarkers(event:ResultEvent):void
      {
      for each(var a:XML in event.result..java::MeterData)
      {
      // ToDo: add marker to GMap
      }
      }

      Of course this does not work and gives me an error 1120: Access of undefined property java. So, I assume that I need to deal with the namespace.

      Can anyone tell me how to deal with this in Flex so that I do not have to make changes to the WS?