aspose file tools*
The moose likes Websphere 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 » Products » Websphere
Bookmark "ErrorHandling in Webservice client" Watch "ErrorHandling in Webservice client" New topic
Author

ErrorHandling in Webservice client

Jon Andr� Fagerholm
Greenhorn

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="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<Fault xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<faultcode xmlns:ns-1671795905="http://webservice.grmf.no" xmlns="">ns-1671795905:WSException</faultcode>
<faultstring xmlns="">< ![CDATA[no.grmf.webservice.WSException]]></faultstring>
<detail xmlns="">
<WSException href="#id0" xmlns="http://webservice.grmf.no"/>
</detail>
</Fault>
<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns-1671795905:WSException" xmlns:ns-1671795905="http://webservice.grmf.no" xmlns="">
<errorMessage xsi:type="xsd:string">My error message</errorMessage>
</multiRef>
</soapenv:Body>
</soapenv:Envelope>

WSException extends Exception and implements Serializable.

I have created a JAX-RPC client running this Webservice. This client receives the Exception as a com.ibm.ws.webservices.engine.WebServicesFault. Here is the information from this object:
- detail = null
- fault actor = null
- fault string = no.grmf.webservice.error.WSException
- fault code = {http://error.webservice. grmf.no}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?
 
jQuery in Action, 2nd edition
 
subject: ErrorHandling in Webservice client