I am writing a web service. So I have:
public interface MyService extends Remote
{
public void service1();
}
public class MyServiceImpl implements MyService
{
public void service1() { /* do something that sometimes throws an exception */ }
}
I was reading about RemoteException. Should I wrap all the code in service1() in a try..catch that wraps any exception in a RemoteException? Then I will have to do it for service2(), service3() and so on.
Is it better to let the invoker (a servlet in my case) to do this?
What exactly should be wrapped in remote exception - everything that happens in the server? or only exceptions dealing with the remote invocation process (reflection, serialization, etc)?