You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Sumudu Chinthaka <cs...@gmail.com> on 2013/06/11 10:31:38 UTC

Async call inside a class

hi

i have a class with a webservice call in the constructor and i want to
handle the result upon successful execution of web service
but Event.COMPLETE inner function never get executed

what should i do to make it possible

if i  place this code in UI component then it;ll get executed but once i
separate it to another class it doesn't work




[Bindable]
public class TestDataProvider
{
 private var isReturn:Boolean = false;
private var originAirport:Airport = new
Airport().AirportInitializer("IKA","IKA","IKA");
private var destinationAirport:Airport = new
Airport().AirportInitializer("DUS","DUS","DUS");
private var departureDate:Date = new Date(2013,5,29);
private var arrivalDate:Date = new Date(2013,5,29);
private var adult:Number = 1;
private var children:Number = 0;
private var infant:Number = 0 ;
 private var flightResult:ArrayCollection;
private var searchCriteria:AvailabilitySearchDTO
private var transactionID:String;
 private var priceQuotResultDTO:PriceQuotResultDTO;
 public function TestDataProvider()
{
searchCriteria = new
AvailabilitySearchDTO().AvailabilitySearchDTOInitializer(this.isReturn,this.originAirport,this.destinationAirport,this.departureDate,this.arrivalDate,this.adult,this.children,this.infant);
var avalabilitySearchReq:AvalabilitySearchRequest = new
AvalabilitySearchRequest(searchCriteria);
 var request:URLRequest = new URLRequest();
var urlLoader:URLLoader = new URLLoader();
 request.contentType = "text/xml; charset=utf-8";
request.method = "POST";
request.url = Globals.ISA_WEB_SERVICE_URL;
 var SOAPAction:URLRequestHeader = new
URLRequestHeader("SOAPAction","getAvailability");
request.requestHeaders.push(SOAPAction);
request.data = avalabilitySearchReq.xmlData;
urlLoader.dataFormat = URLLoaderDataFormat.TEXT;
urlLoader.load(request);
urlLoader.addEventListener(Event.COMPLETE, function (event:Event):void{
 var asObj:Object = XmlUtility.getObjectFromXMLTypeString(event.target.data)
 if(asObj.Envelope.Body.OTA_AirAvailRS.Errors == null)
{
 var tmpObj:Object =
asObj.Envelope.Body.OTA_AirAvailRS.AAAirAvailRSExt.PricedItineraries.PricedItinerary.AirItinerary.OriginDestinationOptions.OriginDestinationOption;
var priceInfo:Object =
asObj.Envelope.Body.OTA_AirAvailRS.AAAirAvailRSExt.PricedItineraries.PricedItinerary.AirItineraryPricingInfo;
transactionID = asObj.Envelope.Body.OTA_AirAvailRS.TransactionIdentifier;
 if(tmpObj is ArrayCollection){
flightResult = tmpObj as ArrayCollection;
}else{
flightResult.addItem(tmpObj);
}
 var searchResDTO:AvailabilitySearchResultDTO = new
AvailabilitySearchResultDTO().AvailabilitySearchResultDTOInitializer(flightResult,searchCriteria,transactionID);
  var request:URLRequest = new URLRequest();
var urlLoader:URLLoader = new URLLoader();
var availabilitySearchResultDTO:AvailabilitySearchResultDTO = searchResDTO;
priceQuotResultDTO = new
PriceQuotResultDTO().PriceQuotResultDTOInitializer(availabilitySearchResultDTO);
 }
 });
 }

Re: RSS Reader -

Posted by Tom Chiverton <tc...@extravision.com>.
How far have you got with the XPath expression and the E4X API calls ?
Have you looked a traversing XML structures 
<http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7e6b.html> 
for instance ?

Tom

On 11/06/2013 14:25, Air Master wrote:
> Hello Everybody!!
>
>
> somebody knows how can I read a Sub-Elements like <media:group>
>
>
> <rss>
> <channel>
> <item>
> <media:group>
> <media:content url='https://abc.com/a.jpg' height='512' width='384' 
> type='image/jpeg' medium='image'/>
> <media:credit>marlon molina</media:credit>
> <media:description type='plain'/>
> <media:title type='plain'>20130610_201116.jpg</media:title>
> </media:group>
> </item>
> </channel>
> </rss>
>
>
>
>
>
>
> ______________________________________________________________________
> This email has been scanned by the Symantec Email Security.cloud service.
> For more information please visit http://www.symanteccloud.com
> ______________________________________________________________________
>
>


RSS Reader -

Posted by Air Master <ai...@nwahd.com>.
Hello Everybody!!


somebody knows how can I read a Sub-Elements like <media:group>


<rss>
<channel>
<item>
<media:group>
<media:content url='https://abc.com/a.jpg' height='512' width='384' 
type='image/jpeg' medium='image'/>
<media:credit>marlon molina</media:credit>
<media:description type='plain'/>
<media:title type='plain'>20130610_201116.jpg</media:title>
</media:group>
</item>
</channel>
</rss>






Re: Async call inside a class

Posted by Sumudu Chinthaka <cs...@gmail.com>.
thanks Raj


On Tue, Jun 11, 2013 at 3:13 PM, Raj U. Shaikh <Ra...@mastek.com>wrote:

> Sumudu,
>
> Try googling on "Responder", "AsyncToken" and "AsyncResponder" class.
> It will help you to make your call asynchronous.
>
> Thanks & Regards,
> Raj Shaikh
>
> -----Original Message-----
> From: Sumudu Chinthaka [mailto:csumudu@gmail.com]
> Sent: Tuesday, June 11, 2013 3:00 PM
> To: users@flex.apache.org
> Subject: Re: Async call inside a class
>
> hi sorry about it here is more clear coding
>
> public class TestDataProvider
> {
> private var result:Object;
>  public function TestDataProvider()
> {
> var request:URLRequest = new URLRequest();
> var urlLoader:URLLoader = new URLLoader();
>  request.contentType = "text/xml; charset=utf-8";
> request.method = "POST";
> request.url = Globals.ISA_WEB_SERVICE_URL;
>  var SOAPAction:URLRequestHeader = new
> URLRequestHeader("SOAPAction","getAvailability");
> request.requestHeaders.push(SOAPAction);
> request.data = avalabilitySearchReq.xmlData;
> urlLoader.dataFormat = URLLoaderDataFormat.TEXT;
> urlLoader.load(request);
> urlLoader.addEventListener(Event.COMPLETE,completeHandler);
> }
>  private function completeHandler(event:Event):void){
> result = event.data;
>  }
>  public function getResult():Object{
> return this.result
> }
>  }
>
>
> what i basically want to do is create of this class and call it's
> getReqult() method to access the result from the webservice call
>
> Ex   var obj:TestDataProvider = new TestDataProvider();
>             obj.getResult();
>
> but the problem is
> completeHandler () function is never get executed and program jumps to next
> instruction as soon as it reached end of constructor
>
> how should i handle this
>
>
> On Tue, Jun 11, 2013 at 2:31 PM, Tom Chiverton <tc...@extravision.com> wrote:
>
> > The formatting in that is screwed up. Please post it somewhere where it
> > stays indented.
> >
> > You probably want to remove all the extra stuff that has no relation to
> > the issue like all the private variables and so on.
> >
> > Tom
> >
> >
> > On 11/06/2013 09:31, Sumudu Chinthaka wrote:
> >
> >> hi
> >>
> >> i have a class with a webservice call in the constructor and i want to
> >> handle the result upon successful execution of web service
> >> but Event.COMPLETE inner function never get executed
> >>
> >> what should i do to make it possible
> >>
> >> if i  place this code in UI component then it;ll get executed but once i
> >> separate it to another class it doesn't work
> >>
> >>
> >>
> >>
> >> [Bindable]
> >> public class TestDataProvider
> >> {
> >>   private var isReturn:Boolean = false;
> >> private var originAirport:Airport = new
> >> Airport().AirportInitializer("**IKA","IKA","IKA");
> >> private var destinationAirport:Airport = new
> >> Airport().AirportInitializer("**DUS","DUS","DUS");
> >> private var departureDate:Date = new Date(2013,5,29);
> >> private var arrivalDate:Date = new Date(2013,5,29);
> >> private var adult:Number = 1;
> >> private var children:Number = 0;
> >> private var infant:Number = 0 ;
> >>   private var flightResult:ArrayCollection;
> >> private var searchCriteria:**AvailabilitySearchDTO
> >> private var transactionID:String;
> >>   private var priceQuotResultDTO:**PriceQuotResultDTO;
> >>   public function TestDataProvider()
> >> {
> >> searchCriteria = new
> >> AvailabilitySearchDTO().**AvailabilitySearchDTOInitializ**
> >> er(this.isReturn,this.**originAirport,this.**destinationAirport,this.**
> >>
> departureDate,this.**arrivalDate,this.adult,this.**children,this.infant);
> >> var avalabilitySearchReq:**AvalabilitySearchRequest = new
> >> AvalabilitySearchRequest(**searchCriteria);
> >>   var request:URLRequest = new URLRequest();
> >> var urlLoader:URLLoader = new URLLoader();
> >>   request.contentType = "text/xml; charset=utf-8";
> >> request.method = "POST";
> >> request.url = Globals.ISA_WEB_SERVICE_URL;
> >>   var SOAPAction:URLRequestHeader = new
> >> URLRequestHeader("SOAPAction",**"getAvailability");
> >> request.requestHeaders.push(**SOAPAction);
> >> request.data = avalabilitySearchReq.xmlData;
> >> urlLoader.dataFormat = URLLoaderDataFormat.TEXT;
> >> urlLoader.load(request);
> >> urlLoader.addEventListener(**Event.COMPLETE, function
> (event:Event):void{
> >>   var asObj:Object = XmlUtility.**getObjectFromXMLTypeString(**
> >> event.target.data)
> >>   if(asObj.Envelope.Body.OTA_**AirAvailRS.Errors == null)
> >> {
> >>   var tmpObj:Object =
> >>
> asObj.Envelope.Body.OTA_**AirAvailRS.AAAirAvailRSExt.**PricedItineraries.
> >> **PricedItinerary.AirItinerary.**OriginDestinationOptions.**
> >> OriginDestinationOption;
> >> var priceInfo:Object =
> >>
> asObj.Envelope.Body.OTA_**AirAvailRS.AAAirAvailRSExt.**PricedItineraries.
> >> **PricedItinerary.**AirItineraryPricingInfo;
> >> transactionID = asObj.Envelope.Body.OTA_**AirAvailRS.**
> >> TransactionIdentifier;
> >>   if(tmpObj is ArrayCollection){
> >> flightResult = tmpObj as ArrayCollection;
> >> }else{
> >> flightResult.addItem(tmpObj);
> >> }
> >>   var searchResDTO:**AvailabilitySearchResultDTO = new
> >> AvailabilitySearchResultDTO().**AvailabilitySearchResultDTOIni**
> >> tializer(flightResult,**searchCriteria,transactionID);
> >>    var request:URLRequest = new URLRequest();
> >> var urlLoader:URLLoader = new URLLoader();
> >> var availabilitySearchResultDTO:**AvailabilitySearchResultDTO =
> >> searchResDTO;
> >> priceQuotResultDTO = new
> >> PriceQuotResultDTO().**PriceQuotResultDTOInitializer(**
> >> availabilitySearchResultDTO);
> >>   }
> >>   });
> >>   }
> >>
> >>
> >> ______________________________**______________________________**
> >> __________
> >> This email has been scanned by the Symantec Email Security.cloud
> service.
> >> For more information please visit http://www.symanteccloud.com
> >> ______________________________**______________________________**
> >> __________
> >>
> >
> >
> MASTEK LTD.
> In the US, we're called MAJESCOMASTEK
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Opinions expressed in this e-mail are those of the individual and not that
> of Mastek Limited, unless specifically indicated to that effect. Mastek
> Limited does not accept any responsibility or liability for it. This e-mail
> and attachments (if any) transmitted with it are confidential and/or
> privileged and solely for the use of the intended person or entity to which
> it is addressed. Any review, re-transmission, dissemination or other use of
> or taking of any action in reliance upon this information by persons or
> entities other than the intended recipient is prohibited. This e-mail and
> its attachments have been scanned for the presence of computer viruses. It
> is the responsibility of the recipient to run the virus check on e-mails
> and attachments before opening them. If you have received this e-mail in
> error, kindly delete this e-mail from desktop and server.
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>

RE: Async call inside a class

Posted by "Raj U. Shaikh" <Ra...@mastek.com>.
Sumudu,

Try googling on "Responder", "AsyncToken" and "AsyncResponder" class. 
It will help you to make your call asynchronous.

Thanks & Regards,
Raj Shaikh

-----Original Message-----
From: Sumudu Chinthaka [mailto:csumudu@gmail.com] 
Sent: Tuesday, June 11, 2013 3:00 PM
To: users@flex.apache.org
Subject: Re: Async call inside a class

hi sorry about it here is more clear coding

public class TestDataProvider
{
private var result:Object;
 public function TestDataProvider()
{
var request:URLRequest = new URLRequest();
var urlLoader:URLLoader = new URLLoader();
 request.contentType = "text/xml; charset=utf-8";
request.method = "POST";
request.url = Globals.ISA_WEB_SERVICE_URL;
 var SOAPAction:URLRequestHeader = new
URLRequestHeader("SOAPAction","getAvailability");
request.requestHeaders.push(SOAPAction);
request.data = avalabilitySearchReq.xmlData;
urlLoader.dataFormat = URLLoaderDataFormat.TEXT;
urlLoader.load(request);
urlLoader.addEventListener(Event.COMPLETE,completeHandler);
}
 private function completeHandler(event:Event):void){
result = event.data;
 }
 public function getResult():Object{
return this.result
}
 }


what i basically want to do is create of this class and call it's
getReqult() method to access the result from the webservice call

Ex   var obj:TestDataProvider = new TestDataProvider();
            obj.getResult();

but the problem is
completeHandler () function is never get executed and program jumps to next
instruction as soon as it reached end of constructor

how should i handle this


On Tue, Jun 11, 2013 at 2:31 PM, Tom Chiverton <tc...@extravision.com> wrote:

> The formatting in that is screwed up. Please post it somewhere where it
> stays indented.
>
> You probably want to remove all the extra stuff that has no relation to
> the issue like all the private variables and so on.
>
> Tom
>
>
> On 11/06/2013 09:31, Sumudu Chinthaka wrote:
>
>> hi
>>
>> i have a class with a webservice call in the constructor and i want to
>> handle the result upon successful execution of web service
>> but Event.COMPLETE inner function never get executed
>>
>> what should i do to make it possible
>>
>> if i  place this code in UI component then it;ll get executed but once i
>> separate it to another class it doesn't work
>>
>>
>>
>>
>> [Bindable]
>> public class TestDataProvider
>> {
>>   private var isReturn:Boolean = false;
>> private var originAirport:Airport = new
>> Airport().AirportInitializer("**IKA","IKA","IKA");
>> private var destinationAirport:Airport = new
>> Airport().AirportInitializer("**DUS","DUS","DUS");
>> private var departureDate:Date = new Date(2013,5,29);
>> private var arrivalDate:Date = new Date(2013,5,29);
>> private var adult:Number = 1;
>> private var children:Number = 0;
>> private var infant:Number = 0 ;
>>   private var flightResult:ArrayCollection;
>> private var searchCriteria:**AvailabilitySearchDTO
>> private var transactionID:String;
>>   private var priceQuotResultDTO:**PriceQuotResultDTO;
>>   public function TestDataProvider()
>> {
>> searchCriteria = new
>> AvailabilitySearchDTO().**AvailabilitySearchDTOInitializ**
>> er(this.isReturn,this.**originAirport,this.**destinationAirport,this.**
>> departureDate,this.**arrivalDate,this.adult,this.**children,this.infant);
>> var avalabilitySearchReq:**AvalabilitySearchRequest = new
>> AvalabilitySearchRequest(**searchCriteria);
>>   var request:URLRequest = new URLRequest();
>> var urlLoader:URLLoader = new URLLoader();
>>   request.contentType = "text/xml; charset=utf-8";
>> request.method = "POST";
>> request.url = Globals.ISA_WEB_SERVICE_URL;
>>   var SOAPAction:URLRequestHeader = new
>> URLRequestHeader("SOAPAction",**"getAvailability");
>> request.requestHeaders.push(**SOAPAction);
>> request.data = avalabilitySearchReq.xmlData;
>> urlLoader.dataFormat = URLLoaderDataFormat.TEXT;
>> urlLoader.load(request);
>> urlLoader.addEventListener(**Event.COMPLETE, function (event:Event):void{
>>   var asObj:Object = XmlUtility.**getObjectFromXMLTypeString(**
>> event.target.data)
>>   if(asObj.Envelope.Body.OTA_**AirAvailRS.Errors == null)
>> {
>>   var tmpObj:Object =
>> asObj.Envelope.Body.OTA_**AirAvailRS.AAAirAvailRSExt.**PricedItineraries.
>> **PricedItinerary.AirItinerary.**OriginDestinationOptions.**
>> OriginDestinationOption;
>> var priceInfo:Object =
>> asObj.Envelope.Body.OTA_**AirAvailRS.AAAirAvailRSExt.**PricedItineraries.
>> **PricedItinerary.**AirItineraryPricingInfo;
>> transactionID = asObj.Envelope.Body.OTA_**AirAvailRS.**
>> TransactionIdentifier;
>>   if(tmpObj is ArrayCollection){
>> flightResult = tmpObj as ArrayCollection;
>> }else{
>> flightResult.addItem(tmpObj);
>> }
>>   var searchResDTO:**AvailabilitySearchResultDTO = new
>> AvailabilitySearchResultDTO().**AvailabilitySearchResultDTOIni**
>> tializer(flightResult,**searchCriteria,transactionID);
>>    var request:URLRequest = new URLRequest();
>> var urlLoader:URLLoader = new URLLoader();
>> var availabilitySearchResultDTO:**AvailabilitySearchResultDTO =
>> searchResDTO;
>> priceQuotResultDTO = new
>> PriceQuotResultDTO().**PriceQuotResultDTOInitializer(**
>> availabilitySearchResultDTO);
>>   }
>>   });
>>   }
>>
>>
>> ______________________________**______________________________**
>> __________
>> This email has been scanned by the Symantec Email Security.cloud service.
>> For more information please visit http://www.symanteccloud.com
>> ______________________________**______________________________**
>> __________
>>
>
>
MASTEK LTD.
In the US, we're called MAJESCOMASTEK

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Re: Async call inside a class

Posted by Sumudu Chinthaka <cs...@gmail.com>.
hi sorry about it here is more clear coding

public class TestDataProvider
{
private var result:Object;
 public function TestDataProvider()
{
var request:URLRequest = new URLRequest();
var urlLoader:URLLoader = new URLLoader();
 request.contentType = "text/xml; charset=utf-8";
request.method = "POST";
request.url = Globals.ISA_WEB_SERVICE_URL;
 var SOAPAction:URLRequestHeader = new
URLRequestHeader("SOAPAction","getAvailability");
request.requestHeaders.push(SOAPAction);
request.data = avalabilitySearchReq.xmlData;
urlLoader.dataFormat = URLLoaderDataFormat.TEXT;
urlLoader.load(request);
urlLoader.addEventListener(Event.COMPLETE,completeHandler);
}
 private function completeHandler(event:Event):void){
result = event.data;
 }
 public function getResult():Object{
return this.result
}
 }


what i basically want to do is create of this class and call it's
getReqult() method to access the result from the webservice call

Ex   var obj:TestDataProvider = new TestDataProvider();
            obj.getResult();

but the problem is
completeHandler () function is never get executed and program jumps to next
instruction as soon as it reached end of constructor

how should i handle this


On Tue, Jun 11, 2013 at 2:31 PM, Tom Chiverton <tc...@extravision.com> wrote:

> The formatting in that is screwed up. Please post it somewhere where it
> stays indented.
>
> You probably want to remove all the extra stuff that has no relation to
> the issue like all the private variables and so on.
>
> Tom
>
>
> On 11/06/2013 09:31, Sumudu Chinthaka wrote:
>
>> hi
>>
>> i have a class with a webservice call in the constructor and i want to
>> handle the result upon successful execution of web service
>> but Event.COMPLETE inner function never get executed
>>
>> what should i do to make it possible
>>
>> if i  place this code in UI component then it;ll get executed but once i
>> separate it to another class it doesn't work
>>
>>
>>
>>
>> [Bindable]
>> public class TestDataProvider
>> {
>>   private var isReturn:Boolean = false;
>> private var originAirport:Airport = new
>> Airport().AirportInitializer("**IKA","IKA","IKA");
>> private var destinationAirport:Airport = new
>> Airport().AirportInitializer("**DUS","DUS","DUS");
>> private var departureDate:Date = new Date(2013,5,29);
>> private var arrivalDate:Date = new Date(2013,5,29);
>> private var adult:Number = 1;
>> private var children:Number = 0;
>> private var infant:Number = 0 ;
>>   private var flightResult:ArrayCollection;
>> private var searchCriteria:**AvailabilitySearchDTO
>> private var transactionID:String;
>>   private var priceQuotResultDTO:**PriceQuotResultDTO;
>>   public function TestDataProvider()
>> {
>> searchCriteria = new
>> AvailabilitySearchDTO().**AvailabilitySearchDTOInitializ**
>> er(this.isReturn,this.**originAirport,this.**destinationAirport,this.**
>> departureDate,this.**arrivalDate,this.adult,this.**children,this.infant);
>> var avalabilitySearchReq:**AvalabilitySearchRequest = new
>> AvalabilitySearchRequest(**searchCriteria);
>>   var request:URLRequest = new URLRequest();
>> var urlLoader:URLLoader = new URLLoader();
>>   request.contentType = "text/xml; charset=utf-8";
>> request.method = "POST";
>> request.url = Globals.ISA_WEB_SERVICE_URL;
>>   var SOAPAction:URLRequestHeader = new
>> URLRequestHeader("SOAPAction",**"getAvailability");
>> request.requestHeaders.push(**SOAPAction);
>> request.data = avalabilitySearchReq.xmlData;
>> urlLoader.dataFormat = URLLoaderDataFormat.TEXT;
>> urlLoader.load(request);
>> urlLoader.addEventListener(**Event.COMPLETE, function (event:Event):void{
>>   var asObj:Object = XmlUtility.**getObjectFromXMLTypeString(**
>> event.target.data)
>>   if(asObj.Envelope.Body.OTA_**AirAvailRS.Errors == null)
>> {
>>   var tmpObj:Object =
>> asObj.Envelope.Body.OTA_**AirAvailRS.AAAirAvailRSExt.**PricedItineraries.
>> **PricedItinerary.AirItinerary.**OriginDestinationOptions.**
>> OriginDestinationOption;
>> var priceInfo:Object =
>> asObj.Envelope.Body.OTA_**AirAvailRS.AAAirAvailRSExt.**PricedItineraries.
>> **PricedItinerary.**AirItineraryPricingInfo;
>> transactionID = asObj.Envelope.Body.OTA_**AirAvailRS.**
>> TransactionIdentifier;
>>   if(tmpObj is ArrayCollection){
>> flightResult = tmpObj as ArrayCollection;
>> }else{
>> flightResult.addItem(tmpObj);
>> }
>>   var searchResDTO:**AvailabilitySearchResultDTO = new
>> AvailabilitySearchResultDTO().**AvailabilitySearchResultDTOIni**
>> tializer(flightResult,**searchCriteria,transactionID);
>>    var request:URLRequest = new URLRequest();
>> var urlLoader:URLLoader = new URLLoader();
>> var availabilitySearchResultDTO:**AvailabilitySearchResultDTO =
>> searchResDTO;
>> priceQuotResultDTO = new
>> PriceQuotResultDTO().**PriceQuotResultDTOInitializer(**
>> availabilitySearchResultDTO);
>>   }
>>   });
>>   }
>>
>>
>> ______________________________**______________________________**
>> __________
>> This email has been scanned by the Symantec Email Security.cloud service.
>> For more information please visit http://www.symanteccloud.com
>> ______________________________**______________________________**
>> __________
>>
>
>

Re: Async call inside a class

Posted by Tom Chiverton <tc...@extravision.com>.
The formatting in that is screwed up. Please post it somewhere where it 
stays indented.

You probably want to remove all the extra stuff that has no relation to 
the issue like all the private variables and so on.

Tom

On 11/06/2013 09:31, Sumudu Chinthaka wrote:
> hi
>
> i have a class with a webservice call in the constructor and i want to
> handle the result upon successful execution of web service
> but Event.COMPLETE inner function never get executed
>
> what should i do to make it possible
>
> if i  place this code in UI component then it;ll get executed but once i
> separate it to another class it doesn't work
>
>
>
>
> [Bindable]
> public class TestDataProvider
> {
>   private var isReturn:Boolean = false;
> private var originAirport:Airport = new
> Airport().AirportInitializer("IKA","IKA","IKA");
> private var destinationAirport:Airport = new
> Airport().AirportInitializer("DUS","DUS","DUS");
> private var departureDate:Date = new Date(2013,5,29);
> private var arrivalDate:Date = new Date(2013,5,29);
> private var adult:Number = 1;
> private var children:Number = 0;
> private var infant:Number = 0 ;
>   private var flightResult:ArrayCollection;
> private var searchCriteria:AvailabilitySearchDTO
> private var transactionID:String;
>   private var priceQuotResultDTO:PriceQuotResultDTO;
>   public function TestDataProvider()
> {
> searchCriteria = new
> AvailabilitySearchDTO().AvailabilitySearchDTOInitializer(this.isReturn,this.originAirport,this.destinationAirport,this.departureDate,this.arrivalDate,this.adult,this.children,this.infant);
> var avalabilitySearchReq:AvalabilitySearchRequest = new
> AvalabilitySearchRequest(searchCriteria);
>   var request:URLRequest = new URLRequest();
> var urlLoader:URLLoader = new URLLoader();
>   request.contentType = "text/xml; charset=utf-8";
> request.method = "POST";
> request.url = Globals.ISA_WEB_SERVICE_URL;
>   var SOAPAction:URLRequestHeader = new
> URLRequestHeader("SOAPAction","getAvailability");
> request.requestHeaders.push(SOAPAction);
> request.data = avalabilitySearchReq.xmlData;
> urlLoader.dataFormat = URLLoaderDataFormat.TEXT;
> urlLoader.load(request);
> urlLoader.addEventListener(Event.COMPLETE, function (event:Event):void{
>   var asObj:Object = XmlUtility.getObjectFromXMLTypeString(event.target.data)
>   if(asObj.Envelope.Body.OTA_AirAvailRS.Errors == null)
> {
>   var tmpObj:Object =
> asObj.Envelope.Body.OTA_AirAvailRS.AAAirAvailRSExt.PricedItineraries.PricedItinerary.AirItinerary.OriginDestinationOptions.OriginDestinationOption;
> var priceInfo:Object =
> asObj.Envelope.Body.OTA_AirAvailRS.AAAirAvailRSExt.PricedItineraries.PricedItinerary.AirItineraryPricingInfo;
> transactionID = asObj.Envelope.Body.OTA_AirAvailRS.TransactionIdentifier;
>   if(tmpObj is ArrayCollection){
> flightResult = tmpObj as ArrayCollection;
> }else{
> flightResult.addItem(tmpObj);
> }
>   var searchResDTO:AvailabilitySearchResultDTO = new
> AvailabilitySearchResultDTO().AvailabilitySearchResultDTOInitializer(flightResult,searchCriteria,transactionID);
>    var request:URLRequest = new URLRequest();
> var urlLoader:URLLoader = new URLLoader();
> var availabilitySearchResultDTO:AvailabilitySearchResultDTO = searchResDTO;
> priceQuotResultDTO = new
> PriceQuotResultDTO().PriceQuotResultDTOInitializer(availabilitySearchResultDTO);
>   }
>   });
>   }
>
>
> ______________________________________________________________________
> This email has been scanned by the Symantec Email Security.cloud service.
> For more information please visit http://www.symanteccloud.com
> ______________________________________________________________________