Hi,

I use Axis Faults and Fault-codes without any problems. So I cannot
comprehend your message. But I don not have my own Exception, but I am using
only AxisFaults.

Here are some code-exmaples.
Server-side (in my case its a request-handler)

public class MyHandler extends BasicHandler
{
public void invoke(MessageContext ctx) throws AxisFault
{
  if (...)
  {
    AxisFault fault = new AxisFault();
    fault.setFaultString("Something happened and can be printed on
client-side");
    fault.setFaultCode(new QName(myns, "AnyFaultCode"));
  }
}
}

On client-side you have to catch the RemoteException:

try
{
call.invoke(..);
...
}
catch(RemoteException re)
{
  System.out.println(re.toString); //The FaultString is printed
  if(re instanceof AxisFault)
  {
    AxisFault fault = (AxisFault)re;
    if(fault.getFaultCode().getLocalPart().equals("AnyFaultCode"))
        //do what you want to be done, when that faultcode occurred....
  }
}

Hope this could help. Tell if so

Greetings from Hamburg/Germany
Seppo

-----Ursprüngliche Nachricht-----
Von: David Logan [mailto:[EMAIL PROTECTED]] 
Gesendet: Dienstag, 14. Januar 2003 22:32
An: '[EMAIL PROTECTED]'
Betreff: Axis fault codes


Let me rephrase the question. Is anybody out their using fault codes? If so,
how are you throwing the exception/axis fault on the server?

-----Original Message-----
From: David Logan 
Sent: Tuesday, January 14, 2003 1:51 PM
To: '[EMAIL PROTECTED]'
Subject: RE: AxisFaults


Actually, the
FaultCode={http://schemas.xmlsoap.org/soap/envelope/}Server.generalException

-----Original Message-----
From: David Logan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 14, 2003 1:35 PM
To: '[EMAIL PROTECTED]'
Subject: AxisFaults


What is the best way to create/throw axis faults from the service?

I am having trouble getting the fault code from the exception when caught on
the client. I get the message but the FaultCode is = "";


----------------------------------------------------------------------------
-----------------------------------------------
public class TitanServicesException extends AxisFault {

  public TitanServicesException() {

  }

  public TitanServicesException(String message, String faultCode) {
    super(new QName(faultCode), message, faultCode, null);
  }
}

Reply via email to