errors when webservice is unavailable

  • Thread starter Thread starter Jimmy
  • Start date Start date
J

Jimmy

Hey

Im building an application for a pocket PC 2003 PDA. This application calls
some web services that are on a web server somewhere.

In my application i get errors each time the webservice arent available or
some function in some of the called webservices throws an exception. This is
very annoying for the users of the application.

Any info, links or anything will be very helpful. Anyone knows how to deal
with this?
 
Jimmy,

I would suggest that knowing that the request failed is a good thing.
Otherwise your users may think their data has been sent back etc.

You should do a try/catch to get these exceptions and update your app in a
meaningful way. Like display a broken connection gif etc
 
Hey

Thats what im thinking, but if i make a try/catch in my webservice, i guess
that the exception wont be returned to my PDA application unless i return
the Exception object. Since only one return value is possible (as far as i
know), i will have a problem returning exception objects instead of
int/string/Dataset/etc...

I could of course make the try/catch in my PDA application, and the users
could be made aware of a lost connection (the .gif way of doing this is
quite a nice idea :) ), but that will give me no info whatsoever about
what happened in the web service, and why it did make an error, and it will
give me no way of telling my users why there arent any connection to the
webservice.

Am i dreaming here?

Is it possible to do what i want?

Any suggestion?

By the way, thanks for your help so far. I do appreciate! ;)


Jimmy
 
No your not dreaming and its a nice world of webservices.

Ok there is two issues here.

1. Catching webservice errors and
2. Catching connectivity errors

1. you should log the errors on the webservice so you are aware that things
arent good, the webservice should then return something to the user to say
it went pear shaped. my favourity way is for all my functions to return a
class object which is basically a structure of an int success flag, string
message and then what ever i am returning from the webservice.

So I can test that to what went on in the service, or you can just simply
pass -1 or null which means an error. You user probably doesnt care about
techo messages such as the datatable doesnt have a column xyz, so all you
have to tell him is that it didnt work. Your internal error catch will
tell you this message.

2. as per before catch them locally on the pda and report them to the user
....
 
Ok, so let me just sum it up.

In my web service i need to log all errors to a log file that i place on the
server. That would include that i have to make i filestream and all that.
Thats a good idea. I can then check the file for any errors. But what
happens if writing to the file fails?

Ok, second thing is to make a class consisting of a return value, a string
with the message, and the data that i would like to return. That could be an
int, a string, a DataSet, etc. That means that i would have to make an
instance of the class on both my PDA and my web service. Since im returning
different kind of things i would need to include the data i like to return,
for every possible return value (int, string, DataSet, etc.) and then grab
the returned data from that class. A little overhead i guess, but then i can
do what i want, so thats great. Do i understand this correctly, or am i
missing something?

On the PDA, if no connectivity an error will occur. I just catch this and
tells the user that the service is currently unavailable. I could include a
description of the problem here through the Message Class so that if the
problem persists i will have a chance of knowing what went wrong. Maybe i
could do this in a thread, so that it keeps asking. Then when the user
presses a button he/she will not have to wait for the error (I guess that
connectivity errors can take a while, before the PDA stops trying to get a
hold of the webservice). Is that the way of doing this?

I really appreciate your help! :)

Jimmy
 
Back
Top