This(*) ObjectLockedException returned from a Java-based web service. I want to catch this specific error on .NET.
I use C#. Can anyone suggest a method for the code below? I mean how can I make it work?
try{
service.something();
}catch(ObjectLockedException exx)
{
alert("Hey!, remove the lock");
}
catch
{
//this block is for the rest of the exceptions
}
(*)The Detailed Explnation OF Exception That I want to catch;
java.rmi.RemoteException: error while preparing instance QS.TYR.611;
nested exception is: xy.zrt.ugy.business.ObjectLockedException: Could not obtain lock for QS.TYR.611
If the “something” operation in your service has a fault contract then there will be a detail type that contains the error information for the fault. Look for
FaultContractAttributein your service interface. Given this type,T, you can catchFaultException<T>.If there is no fault contract, you’ll have to catch
FaultExceptionand pick it apart.It’s unlikely that you can catch the nested exception directly… but it ultimately depends on the fault contract.