Lots of times when we use AsyncTokens with Responders, something will go wrong between when the call is made and when it returns. Usually if there is a problem, the fault handler will fire. Because of this, it's fairly straightforward to get information on what has happened in the fault responder function by looking at the FaultEvent's properties, such as the fault property.
But what about when there's an error and the Result handler is the one that fires? This does happen. For example, the infamous Access "Operation must use updateable query" error message in access triggers the result handler.
One of the first things I try to do when there is an error with a database call is to reconstruct the exact call that was made, so I can make the same call directly from a browser. It's not exactly intuitive where to find this information in the ResultEvent that is the parameter in the result handler, but, with a little digging, I found it.
It turns out that AsyncToken has a property called "Message," which is actually a HTTPRequestMessage. HTTPRequestMessage has a "body" property that is described this way: The body of a message contains the specific data that needs to be delivered to the remote destination. This, apparently, is a circuitous way of saying that this is the actual request object that was sent in the HTTPRequest.send() method that returned this token.
Hope this helps someone!
Debugging Responder Result Functions
english mobile
Subscribe to:
Post Comments (Atom)
2 comments:
I don't think so. HTTPRequestMessage doesn't exist outside of Flex, nor does the IMessage interface it implements. I think this is one of the reasons Flex is more popular than Flash for dealing with data.
Possibly you could use these classes by finding the swc that contains mx.rpc and using it in your Flash project, or you could roll your own.
My absolutely all time favorite tool for working with Flex/Flash and HTTP is the Charles Web Debugging Proxy.
It lets you intercept all traffic, record it, save it to disk, replay it, etc. etc. etc.
You *need* this tool.
Post a Comment