Adobe Dreamweaver Forums



Last 10 THreads :         JS Code Completion (Last Post : danilocelic AdobeCommunityExpert - Replies : 1 - Views : 2 )           »          TextArea: Interface for user selection is deficient (Last Post : Amy Blankenship - Replies : 4 - Views : 5 )           »          Convert GIF to SWF (Last Post : Kulczycki - Replies : 0 - Views : 1 )           »          How to Code SWFObject with Alternate Content (Last Post : Nancy O - Replies : 3 - Views : 4 )           »          Hacked Possible through local machine (Last Post : Coldstream - Replies : 17 - Views : 40 )           »          Adobe Flash 10 kills Wimpy (Last Post : midiwriter - Replies : 38 - Views : 254 )           »          Randomnly load and animate videos from xml (Last Post : pillowsr4u - Replies : 0 - Views : 1 )           »          loader onComplete firing, but TextField not disappearing (Last Post : Laura MS - Replies : 4 - Views : 5 )           »          Re: using cast members with case of statement (Last Post : Dave C - Replies : 0 - Views : 1 )           »          Binding problem with form controls in IE (Last Post : BKBK - Replies : 1 - Views : 6 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Other Macromedia/Adobe Products > Flex
 
Tags: ,



Reply
  #1 (permalink)  
Old 07-31-2008, 05:05 PM
tonnimontana
 
Posts: n/a
Diggs:
Default consecutive <webservice>.send()

Hello forum,

I'm new at Flex and ActionScript and I am in trouble with Web Service
Consumption. In my application, I need to call several times to the same Web
Service but with one different request parameter.

The thing is, that once performed all the .send(), the resultHandler is
called, but always with the last value I gave to that request parameter, so the
result is always the same.

I paste some of the code:

[..]
employeeID = "00005001";
wsGetEmployeeData.EmployeeGetdata.send();
employeeID = "00005002";
wsGetEmployeeData.EmployeeGetdata.send();
[..]
private function resultGetEmployeeData(event:ResultEvent):void{
xmlEmpData= wsGetEmployeeData.EmployeeGetdata.lastResult;
[..]
<mx:WebService id="wsGetEmployeeData" wsdl="url">
<mxperation name="EmployeeGetdata"
resultFormat="e4x"
result="resultGetEmployeeData(event);"
fault="faultGetEmployeeData(event);">
<mx:request>
<EmployeeId>{employeeID}</EmployeeId>
</mx:request>
</mxperation>
</mx:WebService>
[..]

Does anyone have an idea of how to call the Same Webservice?

Thank you,
toni




Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-31-2008, 05:05 PM
jcturin@gmail.com
 
Posts: n/a
Diggs:
Default Re: consecutive <webservice>.send()

Hi Tonni, differents methods are possible in your case:

- call your ws with wsGetEmployeeData.EmployeeGetdata.send(employeeId)
- create a stack of ws calls (you're calling the next ws only when you
get result from the first one and then removing it from the stack of
ws).


Sample there:
//>>#######################################
private var isDoingAFlagRequest:Boolean = false;

private function onSetToFlag(event:EventData):void
{
stackFlagsToSet.addItem(event.data);
executeStackFlagsToSet();
}

private function executeStackFlagsToSet():void
{
if (!isDoingAFlagRequest)
{
if (stackFlagsToSet.length != 0)
{
isDoingAFlagRequest = true;
WsInduction.SetFlagToObject(stackFlagsToSet[0].InductionGuid,
stackFlagsToSet[0].FlaggedObjectGuid,
stackFlagsToSet[0].FlaggedObjectName,
stackFlagsToSet[0].FlagId,
onResultExecuteStackFlags);
}
}
}

private function onResultExecuteStackFlags(data:XMLList):void
{
isDoingAFlagRequest = false;
stackFlagsToSet.removeItemAt(0);
if (stackFlagsToSet.length > 0)
{
callLater(executeStackFlagsToSet);
}
}
//>>#######################################

Enjoy your Flex

Jean-Christophe TURIN
Reply With Quote
  #3 (permalink)  
Old 07-31-2008, 05:05 PM
Martyn Jones
 
Posts: n/a
Diggs:
Default Re: consecutive <webservice>.send()

It is my understanding that each WebService.send() will result in your
result handler being called. It is being called twice, but you are
probably only seeing the results of the second call as you are
overwriting the xmlEmpData variable.

I think that you can use AsyncTokens to track the different requests.

Hope this is some help

Martyn


tonnimontana wrote:
> Hello forum,
>
> I'm new at Flex and ActionScript and I am in trouble with Web Service
> Consumption. In my application, I need to call several times to the same Web
> Service but with one different request parameter.
>
> The thing is, that once performed all the .send(), the resultHandler is
> called, but always with the last value I gave to that request parameter, so the
> result is always the same.
>
> I paste some of the code:
>
> [..]
> employeeID = "00005001";
> wsGetEmployeeData.EmployeeGetdata.send();
> employeeID = "00005002";
> wsGetEmployeeData.EmployeeGetdata.send();
> [..]
> private function resultGetEmployeeData(event:ResultEvent):void{
> xmlEmpData= wsGetEmployeeData.EmployeeGetdata.lastResult;
> [..]
> <mx:WebService id="wsGetEmployeeData" wsdl="url">
> <mxperation name="EmployeeGetdata"
> resultFormat="e4x"
> result="resultGetEmployeeData(event);"
> fault="faultGetEmployeeData(event);">
> <mx:request>
> <EmployeeId>{employeeID}</EmployeeId>
> </mx:request>
> </mxperation>
> </mx:WebService>
> [..]
>
> Does anyone have an idea of how to call the Same Webservice?
>
> Thank you,
> toni
>
>

Reply With Quote


  #4 (permalink)  
Old 07-31-2008, 09:42 PM
batmitra
 
Posts: n/a
Diggs:
Default Re: consecutive <webservice>.send()

hi
why are you calling your webservices like that? there's an much easier way to
do that:
like this

if you have you webservice definition in mxm like

<mx:webservice name="youwebservice" wsdl="yourwebservice path?wsdl">
<mxperation name="youroperationname" result="your result handler function"/>
</mx:webservice>

then in actionscript you can call it like:

yourwebservice.youroperationname(yourparameter)

and this wil return each time a diferente result depending on what you send as
parameter.

the .send way is used with httpservice because it doesn't have methods defined


Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 06:02 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Inactive Reminders By Mished.co.uk