Skip to main content
Inspiring
March 24, 2009
Question

Keeping WebService responses straight

  • March 24, 2009
  • 6 replies
  • 580 views
After a bit of a struggle, I've managed to get the flex WebService class working with my Flash CS4 project thanks to this:
http://flashauthoring.blogspot.com/2008/10/using-flex-webservice-component-in.html

The problem I'm having is that If I do two calls in rapid succession to different methods of the same WebService, then I can't distinguish the results when they come back. In my project, my function onWebServiceData would trigger twice, but I couldn't tell which time was in response to Method1 and which was in response to Method2.

I've attached a stripped down version of my code:

Any suggestions about how to sort this out would be much appreciated.
This topic has been closed for replies.

6 replies

sneakyimpAuthor
Inspiring
March 25, 2009
so you are actually getting a value for action? Perhaps it depends on the WSDL command you run? Or the WSDL gateway you are using?
Participant
March 25, 2009
Worked for me
sneakyimpAuthor
Inspiring
March 25, 2009
OK the getSoapAction() method keeps returning the empty string.

I imported this to get rid of compiler complaints:
import mx.messaging.messages.SOAPMessage;


these two lines result in action = ""
var soapMesg:* = event.token.message as SOAPMessage;
var action:String = soapMesg.getSOAPAction();
sneakyimpAuthor
Inspiring
March 24, 2009
Thanks for the replies! I like that second one pretty much. I was doing a lot of trace calls on the events that came back and they didn't seem to have any properties. I'll see if I can check it out again.
March 24, 2009
... or you could work with the message property of the event. i.e.
March 24, 2009
When you invoke a method, you can store the returned mx.rpc.AsyncToken and check against the value dispatched with the event. i.e.