• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ErrorHandling in Webservice client

 
Jon Andr� Fagerholm
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you had a look at this sample http://cvs.apache.org/viewcvs.cgi/ws-axis/java/samples/faults/ by Apache Axis, you can try to see what they are doing for reading the faults..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic