But that is not what I need. I mean programmly, I need dynamaically detect if my session is expire by catch Exception. There are many exception could occur, after I catch the exception, how can I tell the session expire exception from the other exception.
You need to examine the fault code returned by the call. A fault message is a valid message in SOAP and (I believe) is bubbled up from the Axis libraries. Generally, there are not that many exceptions that can be thrown on a call. You can explicitly catch the expected exceptions thrown by Axis and, by process of elimination catch the exception that is thrown by the fault.
It is useful to discuss exceptions in terms of Java execution and faults in terms of Soap errors. If you don't have access to the fault code, you can lookup the fault message in the documentation and use that to determine the fault that occurred.
Ah, it appears you are using XML-RPC. I'm not sure what type of exception handling is available, as my understanding is that XML-RPC does not have the same robust fault mechanism that SOAP provides.
If you switch to SOAP (Apache Axis), you will be able to try/catch for an exception as if it were a "local" method call.
if you try to make a command, it should say: user not logged in, and then ask you for your username and password, or atleast that is what my API does.
Hi,
Thanks.
But that is not what I need. I mean programmly, I need dynamaically detect if my session is expire by catch Exception. There are many exception could occur, after I catch the exception, how can I tell the session expire exception from the other exception.
peilei
You need to examine the fault code returned by the call. A fault message is a valid message in SOAP and (I believe) is bubbled up from the Axis libraries. Generally, there are not that many exceptions that can be thrown on a call. You can explicitly catch the expected exceptions thrown by Axis and, by process of elimination catch the exception that is thrown by the fault.
It is useful to discuss exceptions in terms of Java execution and faults in terms of Soap errors. If you don't have access to the fault code, you can lookup the fault message in the documentation and use that to determine the fault that occurred.
Message Edited by DevAngel on 07-24-2003 05:59 PM
Hi,
Object result = (Object) xmlrpc.execute(methodName, param);
if the call fail, the result is null. It looks that I can't access the fault code. Is that right?
But I can get fault message from exception.
Thank you.
Hi pl,
I am currently on the road. I will have a solution for you Tuesday.
Anyone else care to take a stab at this?
If you switch to SOAP (Apache Axis), you will be able to try/catch for an exception as if it were a "local" method call.
Thank you.
A lot of work already were done using XMP-RPC. At this point I don't know how much benefits I get by switching to apache axis Soap.
I am able to try/catch for an exception as if it were a "local" method call. Just exception only have fault message no fault code.
Please let me know.
Thanks