on 12-29-2007 9:54 AM
Hello SDN!
Here is a code:
try{
wdContext.currentMnRemoveTypeElement().setTypeId(typeId);
wdContext.currentMnReqRemoveTypeElement().modelObject().execute();
wdContext.currentMnRemoveTypeErrorPartElement();
msgMgr.reportSuccess("Information deleted.");
}catch(Exception ex){
// print error message
}
If I import web service as Web Service Model (DEPRECATED), model method execute() throws exception with type Exception, but if I'm using a Adaptive Web Service model, method execute() throws exception with type CMIException. This method connected with EJB method which throws DRException (it's my own type of exceptions extends Exception).
When I call this code an exception is occured, but type of ex is ClassCastException and error message is empty whereas I expect a DRException with my error message. I think that reason is failed to cast DRException toCMIException...
So how I can pass my own exception from EJB webservice to Adaptive Web Service model?
regards, Lev
Hi,
You can throw the exception in the following way:
try{
// web-service method call
return "SUCCESS";
}catch(Exception ex){
return ex.getMessage();
// Or for cutomized mesg, instead of above line you can write:
return "YOUR MESSAGE";
// print error message
}
These changes you can do at the web-service end.
Hope this will solve your problem.
thanks & regards,
Manoj
Edited by: Manoj Kumar on Dec 31, 2007 10:39 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello, Manoj!
Of course, your way will working but in my opinion there is wrong logic. I think that error (when occurs) and error descripton must be passed only from webservice method. Also I want to understand why webservice method throws so strange exceptions which cannot be casted to exceptions of my type. So I need that webservice method throws exceptions of my own type.
regards
Lev
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.