Two Laptop Bag
The moose likes Web Services and the fly likes ErrorHandling in Webservice client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "ErrorHandling in Webservice client" Watch "ErrorHandling in Webservice client" New topic

ErrorHandling in Webservice client

Jon Andr� Fagerholm

Joined: Oct 26, 2004
Posts: 2
I am working on a Web Service solution running on WebSphere 5.1. One method of this Webservice throws RemoteException and WSException. WSException is a user-defined exception.

I can see from the SOAP-response(using XML-spy) that the exception is presented in the detail-field in the Fault-object.

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="" xmlns:soapenc="" xmlns:xsd="" xmlns:xsi="">
<Fault xmlns="">
<faultcode xmlns:ns-1671795905="" xmlns="">ns-1671795905:WSException</faultcode>
<faultstring xmlns=""><![CDATA[no.grmf.webservice.WSException]]></faultstring>
<detail xmlns="">
<WSException href="#id0" xmlns=""/>
<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="" xsi:type="ns-1671795905:WSException" xmlns:ns-1671795905="" xmlns="">
<errorMessage xsi:type="xsd:string">My error message</errorMessage>

WSException extends Exception and implements Serializable.

I have created a JAX-RPC client running this Webservice. This client receives the Exception as a Here is the information from this object:
- detail = null
- fault actor = null
- fault string = no.grmf.webservice.error.WSException
- fault code = {http://error.webservice.}WSException
- fault details = [Lorg.w3c.dom.Element;@da6bf4

My problem is that I don�t find a way to get the WSException and read the ErrorMessage.
Is it possible to retrieve this Exception and the ErrorMessage, and if so, how do I do so?
Balaji Loganathan
author and deputy

Joined: Jul 13, 2001
Posts: 3150
Did you had a look at this sample by Apache Axis, you can try to see what they are doing for reading the faults..

Spritle Software Blogs
I agree. Here's the link:
subject: ErrorHandling in Webservice client
jQuery in Action, 3rd edition