This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem with a webserver that delay a lot to answer  RSS feed

 
Natalia Lopez
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
I did a webservice that is working ok in java, in fact are 3 services each one make a diferent function.
I did a client application too, that connect with webservice 2 are working ok, but one of them delay 35 seconds to answer and the client Application crash with the following error
junit.framework.AssertionFailedError: Remote Exception caught: (0)null
at ws.appClient.Frame.ProcesarCarga_actionPerformed(Frame.java:185)

...
What can I do, is any possibility to set a long time to Application to evoid the exception anda wait more time for the response?
Regards

Natalia
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
junit.framework.AssertionFailedError: Remote Exception caught: (0)null
at ws.appClient.Frame.ProcesarCarga_actionPerformed(Frame.java:185)


That looks like a more serious error than just running out of time. Seems to me you should be figuring out why that JUnit assertion if failing.

Bill
 
Natalia Lopez
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes I did but I'm sure that the problem is with the response delay.
I did a new webservice with this inside

System.out.println("goin to wait");
try {
Thread.sleep(45000);
} catch( InterruptedException sexep ) { }

System.out.println("finish waiting");


If I change 45000 to 20000 there is not problem and the desktop application get response. With The 45000 I received the error
junit.framework.AssertionFailedError: Remote Exception caught ...............

Any idea?
Regards

Naty
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. you should always design clients to fail gracefully if the connection to the service fails in any way. Some sort of useful message - such as "connection timed out" is a good idea. Apparently your client just charges ahead, assuming good data was returned.

2. On the service side you must provide for responding with an error message if the request can not be handled. Logging the reason is a good idea.

Bill
 
Natalia Lopez
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm agree with you but I wonder if there is a way to wait for a long time from my client Application ? There is a way wait indefinitely indefinitely from client application a webservice response?

Regards
Naty
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!