You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Rich Catlett <ri...@more.net> on 2001/08/11 01:13:02 UTC

convenience method to retreive soap exception from envelope

It seems that it would make a whole lot of sense to have some sort of 
method to retreive a SOAPException from the response envelope if one 
occured, and I wnodered if anyone had done anything to this effect.  My 
thoughts would be that if an error occurs then a header is set such as 
SOAPException.occured=true , then if an exception occurs, you could do a 
returnenvelope = message.receiveEnvelope();  add a method to the 
envelope called isError() which does a returnenvelope.getHeader() and 
then checks for the SOAPException header and returns true or false.  If 
true you could then call a method called getException() which creates 
SOAPException object which already has methods for getting the 
faultcode, the exception itself, the root exception, and the message. 
 Currently I don't really have the time to devote to this myself, 
although I am going to write something smaller using regular expressions 
(all it takes is to read the whole response into a string and then run 
regular expressions on it to see if it contains SOAP-ENV:Fault, and 
others to extract the faultcode and the exception itself.  I was 
wondering though if anyone had dealt with this before and done anything 
similar.

Rich Catlett