0

When using flex remote objects is there a way to look at the raw data received back from the server, for example as string?

I have a faultHandler set in my code and occasionally see faults, but the fault description in flex is very vague. For example, it might show 'Delivery In Doubt', or similar.

I just want to know for sure whether I received any data from the server, and ideally, what it was. Possibly if I had a server side error, I could see it in my client log in that case.

Note that these failures are not easy to reproduce, and I am familiar with sniffers such as fiddler. The issue is end users will occasionally have a fault, which I keep track of, but I am hoping to get more information to figure out why.

Scott Szretter
  • 3,938
  • 11
  • 57
  • 76

2 Answers2

1

When using flex remote objects is there a way to look at the raw data received back from the server, for example as string?

Yes, normally I would use ServiceCapture to do this. Charles is another option; and Flash Builder even has some Network Monitor feature built right in to the IDE. I see you mentioned Fiddler, which I believe to be in similar to the other tools.

I have never seen a fault handler give the message "delivery in doubt". If you stop your code in debug mode; you can place a watch in your fault handler and look at the fault event. From there you should be able to drill down into the actual error. The FaultEvent should give you everything you need to know.

You can try taking a look at FaultEvent.fault.content for the actual returned text.

JeffryHouser
  • 39,401
  • 4
  • 38
  • 59
  • My issue is that it rarely happens when I am debugging. It might for example happen only a few times in a 24 hour period for the end users (20+ users). So it's unlikely that I am going to be able to duplicate the issue to be able to sniff it or trace it using flex. – Scott Szretter Aug 26 '12 at 23:00
  • 1
    @ScottSzretter Perhaps it is [global error handling](http://www.adobe.com/devnet/flex/articles/global-exception-handling.html) you are looking for then? – RIAstar Aug 26 '12 at 23:04
  • Rarely happens; or never happens? If you can repliate it sometimesl; you're better off than most of us debugging user bugs. There is no reason why you can't "capture" the content of the request; as I stated in my post and do something with it, such as displaying it to the user or capturing it in a log somehow; or sending it to a different service to email the results to you.. – JeffryHouser Aug 27 '12 at 01:19
  • 1
    I think FaultEvent.fault.content might work for what I need, but it returns an object. Whats the proper way to convert it to meaningful text? I tried .toString() and String() around it and see "[object Object]". – Scott Szretter Jan 13 '13 at 22:35
  • [object Object] is the result of the default toString() method. Since content is an Object; that is what I'd expect if you try to convert it to a String. I suspect that will be more useful in debug mode; so you can try to figure out exactly what is getting returned. – JeffryHouser Jan 13 '13 at 23:08
0

You could try something like:

private function handleFault(e:FaultEvent):void
{
    trace(ObjectUtil.toString(e.fault.content));
}
cjaube
  • 173
  • 6