Skip navigation
TigerLittle
Currently Being Moderated

Flex communicate with Web Service is slow

Jun 21, 2006 9:14 AM

My web service code is :
<mx:WebService id="MyServices" destination="myWS" useProxy="true" showBusyCursor="true" makeObjectsBindable="false">
<mx:operation name="getCred">
<mx:request xmlns="">
<Username>
{username.text}
</Username>
<Password>
{password.text}
</Password>
</mx:request>
</mx:operation>
<mx:operation name="getPlants">
<mx:request xmlns="">
<Cred>
{credModel}
</Cred>
</mx:request>
</mx:operation>
</mx:WebService>

It uses proxy. When I call it, it click button and call getCred(event) in ActionScript:
public function getCred(event:Event):void{
MyServices.getCred.send();
}

And result:
<mx:Model id="credModel">
{MyServices.getCred.lastResult}
</mx:Model>

My problem is the time from I click button to call the send() to the browse display my cred value takes about 6-7 seconds. And same time to call other web service operation. It is an unacceptable long time. Any one knows why it takes so long time and how to solve it?

Thanks.
 
Replies
  • Currently Being Moderated
    Jun 21, 2006 10:57 AM   in reply to TigerLittle
    What control are you using to display the data?

    If you are using the proxy, turn on webservice debugging in the flex-config.xml file, run the flex server from a command window, and observer the data flow.

    You may see that it is not the data call that is taking the time, but rather the UI rendering.

    On the other hand, the web service might just be slow.

    Tracy
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 21, 2006 2:20 PM   in reply to TigerLittle
    What is your application server? You can't do what I suggested using Tomcat because it always runs as a service.

    It might be easier to time the response in Flex .

    Create a variable at the application level, say iSendCall:Number;
    Then, in the code where you do the send(), do:
    iSendCall = getTimer();

    Then in the result handler function, do:
    var iReturn:Number = getTimer();
    alert("Elapsed: " + (iReturn - iSendCall);

    This will tell you the number of milliseconds it took for the data to return.

    Tracy
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 21, 2006 3:23 PM   in reply to TigerLittle
    Did you use getTimer exactly as I suggested, in the send() and result handler function?

    What was the elapsed time?

    Tracy
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 21, 2006 5:09 PM   in reply to TigerLittle
    Ok, that is fine, and you are measuring the actual data call time. And that IS slow!

    Is that a public web service? One that I can test against?

    I am concerned, because I do not know of any way to affect what happens between the send() and the result.

    Can you test against some other web service to see if it is slow as well?

    Tracy
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 22, 2006 1:11 PM   in reply to TigerLittle
    I am sorry, I do not know what else to suggest. I do not see anything wrong with your code, and besides, I don't know of anything you can do in code that affects the time of a webservice data return.

    I'll keep thinking.

    Tracy
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 22, 2006 1:32 PM   in reply to TigerLittle
    Perhaps you could try calling the webservice without the proxy?
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 22, 2006 1:42 PM   in reply to ntsiii
    Try running this sample app. It reports the elapsed time in a label to the right of the TextArea. I get about 445ms.
    Tracy

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 22, 2006 2:50 PM   in reply to TigerLittle
    If you do not use the proxy, and the web service is not on the EXACT same domain as the Flex app, then you must have a crossdomain.xml file in the root of the web site serving the web service.

    Tracy
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 28, 2006 10:01 AM   in reply to TigerLittle
    Try the full permission domain spec:
    domain="*"

    And the file needs to go in the root of the WEB applcation. If in doubt put it everywhere until it works, them remove til it breaks.

    Tracy
     
    |
    Mark as:
  • Currently Being Moderated
    Aug 11, 2009 10:02 AM   in reply to TigerLittle

    I am wondering if this ever got resolved because I am experiencing the same problems. The web service call is taking forever 5-6 seconds to respond. If i call to the same web service from .Net it is very fast.

     

    The web services and swf files are on the same server which is using https and basic authentication. I am not using a proxy.

     

    Any help would be greatly appreciated.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points