aspose file tools*
The moose likes Web Services and the fly likes Handle Exception in Web Service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Handle Exception in Web Service" Watch "Handle Exception in Web Service" New topic
Author

Handle Exception in Web Service

Smita S. Mutha
Greenhorn

Joined: Aug 05, 2008
Posts: 8
Hi,

I am new to web services world.
Can someone please tell me how can I handle exception occered in Service.
i.e.

If there is any exception while executing the service method code, if any exception occurs, may be run time exception or, some error condition, where custom message need to be sent back to user, how can one do it?

Can we send the exception/message in Soap:Fault. Or
I need to have some provision in return type of method.

Please help.


--------------------------------<br />SCJP (91%), SCWCD(89%)<br />ON the way to SCDJWS...
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12671
    
    5
Most SOAP toolkits will create a SOAP message with a Fault message.
The requirements for error handling are laid out in the by now very lengthy SOAP specification.

Be aware that if your request never gets through to your SOAP service due to some addressing problem, the server will probably send back a plain HTML message and an error code that your SOAP client may have a hard time interpreting.

Most developers use something like TCPMON to record the exact text of request and response when debugging.

Bill


Java Resources at www.wbrogden.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Handle Exception in Web Service
 
Similar Threads
Questions about JMS exception handling
SOAPFault
Tomcat Efficiency
Generic WebService Client
Conversion of service specific exceptions to Runtime exceptions in WS.