Skip navigation
nakea
Currently Being Moderated

Reading web service results

Aug 29, 2013 6:44 PM

Tags: #flashbuilder4.7

I have a flex application that consumes a web service I wrote in .net.

 

I'm having a hard time figuring out how to read the results of a CallResponder in my AS block, where I want to have some logic that makes a decision base on the result.

 

-----------------------------

 

Example:

 

I have a webservice call (wsdl) that returns a Boolean response to whether an account exists based on an email and password passed in the call.

 

If I add the service to the Data/Services section, then right-click to generate the servcie call using FlashBuilder's auto-generate feature, it creates CallResponder and the ResultHandler function.

 

In the ResultHandler, It creates a CallResponder.token.

 

I've tried to cast it as a Boolean and run it through an "if" statement, but it always comes up false.

 

----------------------------------

 

I have the same problem just reading the result, which I understand is returned as an object wrapped around an ArrayCollection. How do I read the response of a webservice call that returns an  Array of string results.

 

I've found a number of examples to simply bind to visual controls, which is great, but how do I read individual results to run some logic?

 

Appreciate the help and sorry if this is such a basic request. I'm a newby to Flex/FlashBuilder.

 
Replies
  • Currently Being Moderated
    Aug 30, 2013 7:22 AM   in reply to nakea

    Have you looked here?

     

    http://livedocs.adobe.com/flex/3/html/help.html?content=data_access_6. html

     

    If nothing else, use the debugger in the result handler to examine what the result is.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 31, 2013 10:53 AM   in reply to nakea

    You can't handle the result of the HTTP call inside the click handler - it's asynchronous.

     

    In the example I provided the link for there's a result handler for the http call: onResult

     

    That's where you handle the result - not in the click handler.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 31, 2013 3:43 PM   in reply to nakea

    You DO NOT CALL the onResult function. It is called by the system when a result is received from the remote server.

     

    When you send the HTTP request to the remote server your code continues before the result is ready.

     

    You really need to spend some time understanding the differrence between synchronous and asynchronous events.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 4, 2013 10:53 PM   in reply to nakea

    try to use event.result.GetListResult.Notes[1].Note

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 5, 2013 2:11 AM   in reply to nakea

    because the xml namspace

     

    you define  xmlns="http://Nakea.net/TPI"

     

    so we should access the node in this namespace

     

    the code:

     

    public function showResult(event:ResultEvent):void

    {

        var resultXML:XML = event.result;

        var defaultNS:Namespace = resultXML.namespace();

        txtArea2.text = resultXML.defaultNS::GetListResult.defaultNS::Notes[1].defaultNS::Not e;

    }

     
    |
    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