I've been given a Flex application which made use of a RESTFUL service.
I've managed to create a SQLite DB which stored data from the service and now I would like the application to be able to run offline and make use of the data existing in it's local DB. This works fine the only problem is that the httpService object throws a fault when it cannot connect.
If I don't provide a method to handle the fault event then it is displayed in an error window.
If I provide a blank method to handle the fault then it is still displayed in an error window.
How can I get it to stop displaying this error Window?
Regards,
Craig
Check for a network connection before making the httpservice request.
Flex 3 - Adobe Flex 3 Help - Network Connectivity
That way, when an exception occurs it's really an unexpected behavior instead of something that could be regular program usage.
Never Mind... Problem was that something else was generating the same fault...
Related
I am using java and google calendar API to insert/update/delete events from my google calendar. It is working fine.. At times it throws Connection Reset error when writing or updating the event via API.
Is there any possibility to resolve this issue.?
Thanks in advance..
If this is a java code, maybe the SO Posts below can help you determine what's wrong and where did you messed up in your code. Since I am not sure what code you are using, I'll give you an example where this error always occur.
SO post 1
"Exception in thread "main" java.net.SocketException: Connection
reset" error occurs when the opponent is forcibly terminated without
calling close().
Maybe there is something in your code that forced the opponent to be terminated without calling the close() function.
If that's the case, you can add this two line in both
Client
skt.close();
and ServerSock
ss.close();
Note: java.io.Closeable implementing object must call close ().
SO post 2
javadoc for SocketException states that
Thrown to indicate that there is an error in the underlying protocol
such as a TCP error
The connection in the server end maybe closed and caused the issue when sending the issue at their end.
To aid debugging you could look at using a tool such as Wireshark to
view the actual network packets. Also, is there an alternative client
to your Java code that you could use to test the web service? If this
was successful it could indicate a bug in the Java code.
As you are using Commons HTTP Client have a look at the Common HTTP
Client Logging Guide. This will tell you how to log the request at the
HTTP level.
Hope 1 of these two answers will help you.
I'm working on a project where we use Flex, Spring, Hibernate and Blazeds, all working on a Weblogic server.
Everything works fine and we call services at the server side from the flex app without problems, but now we need to limit the time who spent the execution of the services to 2 seconds, if any service takes more than 2 seconds the server must return a timeout to the flex app.
I've been searching for a way to do this with the blazeds configuration, but it looks that it's not possible.
¿Is there any way to achieve this? I've thought in add a filter to the blazeds requests so it can control the timeout... But I can't find any example and I don't have enough knowledge of filters.
¿Could you help me with this problem?
Thanks.
I think you can set the timeout on RemoteObject OR Webservice.. whatever you are using. Once the specified timeout happens, it will throw a FaultEvent, which is when you supposed to take an appropriate action like for RemoteObject's use their channel's disconnect and so..
Look at this post:
Flex RemoteObject timeouts?
When i run it in Flash Builder (debug mode) the remote object called successfully. but whenever i build the application (AIR application), then the remote object will return no result nor fault, the busy cursor is showing about 3 seconds. then no clue at all.
Any idea how to get advance fault or something than regular fault event or result event?
or anyone have the same experience?
UPDATE:
Actually it was failed only for ONE service method, for other method (some of them took longer time to call) the service call is work fine.
CASE SOLVED
So the problem was not on the service call, but on my result conversion that cause the advanced datagrid failed to render.
Best regards
ktutnik.
Try using a software like Charles to see what happens during the network call.
How do you capture errors that happen on client side when building RIA apps using Flex and Silverlight? What are the common practices? I have seen some asynch js calls to a web service implemented but would like to know how the community is dealing with it.
First, I use client side logging all of the times.
the way I handle it depends on the entire application.
if I use an AMF gateway then there's a call for an application error, with every error that occurs the server is notified, in the server side a bug is open in BugZilla (this is what we use, you can use any other hook you want).
If I use a web-service based application then there's a web-service call for a client error.
one would say you shouldn't sample the server with every error, I disagree with this comment because an error in the client side is rare, it goes thorough QA before being released to the client so I want to know immediately on every error the client is experiencing.
In Silverlight I like to use a WebClient to log back to a web service somewhere -- you can do this directly in the Silverlight application without calling out to JavaScript.
To catch exceptions that are fired when your code isn't on the stack, you can use the Application.UnhandledException event.
I've used the same approach as Avi Tzurel - you need to know on the server side when an error appeared in the Flex client. If you want to collect more data (all the log messages, warnings) I would use an internal buffer and I will flush it asynchronously.
Anyway, you need to take into consideration if your customers are ok with this approach..maybe you need their agreement before sending the error message to the server.
I basically percolate all errors to the top, and capture them in the unhandled exception. I display a friendly message to the user. However, throughout my application I implement an ILogger interface. This interface can be initialized with various levels and handles any messaging. You can set it up so the user can add an init param to determine whether or not to transmit the errors to a service, and I typically have the logger write the messages with Debug.WriteLine if the debugger is attached to make it very easy to trace issues in debug mode.
In Silverlight you may want to consider the Logging and Exception Handling Application Blocks from the Silverlight Integration Pack for Enterprise Library.
I'm getting occasional ConcurrencyError faults when using HTTPService in Flex 3. I have four HTTPService objects, all configured with concurrency=single. I'm not sure though how to continue to diagnose, as I don't see in the FaultEvent what service object caused the issue, and I can't easily reproduce it on-demand.
One feature of my app is that I am also using a URLRequest to load a sound shortly after receiving a result from one of the HTTPService calls. Could this be related to the concurrency error?
The fault looks like this:
[FaultEvent fault=[RPC Fault faultString="Attempt to invoke while another call is pending. Either change concurrency options or avoid multiple calls." faultCode="ConcurrencyError" faultDetail="null"] messageId=null type="fault" bubbles=false cancelable=true eventPhase=2]
Huh. I'm going to call it a bug in Flex 3.2 because upgrading to 3.4 got rid of it.