You can store a FaultCode on your serverside with a QName, that describes,
that the AxisFault is formally an SQLException, and put the data from
SQLException into the new AxisFault, you are generating. Thats the way Im
doing to know, what happened on server-side. E.g. if tere is no
DB-Connection I throw an AxisFault with a specified FaultCode and on client
side I can force the user to login to DB and afterwards fullfill his
request.
In the code it could look like:

server-side:
public void myMethod() throws SQLException
{
  try
  {
    ....
  }
  catch(SQLException sql)
  {
    AxisFault fault = new AxisFault();
    fault.setFaultString(sqle.toString());
    fault.setFaultCode(new QName("myNameSpace", "SQLException"));
    throw fault;
  } 
}

client-side
try
{
  call.invoke(...);
}
catch(RemoteException re)
{
  if(re instanceof AxisFault)
  {
    AxisFault fault = (AxisFault)re;
    if (fault.getFaultCode().getLocalPart().equals("SQLException"))
    {
    ....
    }
  }
}

hope this could help. If yes, tell me...

Greetings from Hamburg/Germany
Sebastian Beyer
Softwareengineer
Wettschereck & Partner
Gesellschaft für Informationstechnologie mbH
Ziethenstraße 14A
22041 Hamburg
Tel.  +49-40-689468-0
Fax. +49-40-689468-99


-----Ursprüngliche Nachricht-----
Von: Matthew Denner [mailto:[EMAIL PROTECTED]]
Gesendet: Donnerstag, 9. Januar 2003 22:19
An: [EMAIL PROTECTED]
Betreff: Some way to recreate a server side exception on the client?


Hi,

Is there any way to recreate the exception thrown on the server side of 
an Axis SOAP connection on the client side?  For instance, say my 
service throws an SQLException, can I get it recreated (obviously 
without the original stack trace) on the client side?  I see that an 
org.apache.axis.AxisFault is what is actually thrown but this doesn't 
appear to achieve (quite) what I want.  I'm using the 1.1b release of Axis.

Any help much appreciated.

Matt

Reply via email to