Hi,

can somebody help me with custom exceptions? No matter what I do I
always get a generic XFireRuntimeException on the client, like this:

org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested 
exception is org.codehaus.xfire.fault.XFireFault: less zero!
org.codehaus.xfire.fault.XFireFault: less zero!
        at 
org.codehaus.xfire.fault.Soap11FaultSerializer.readMessage(Soap11FaultSerializer.java:31)
        at 
org.codehaus.xfire.fault.SoapFaultSerializer.readMessage(SoapFaultSerializer.java:28)
        at 
org.codehaus.xfire.soap.handler.ReadHeadersHandler.checkForFault(ReadHeadersHandler.java:111)
        at 
org.codehaus.xfire.soap.handler.ReadHeadersHandler.invoke(ReadHeadersHandler.java:67)
        at 
org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
        at org.codehaus.xfire.client.Client.onReceive(Client.java:406)
        at 
org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:139)
        at 
org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
        at 
org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
        at 
org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
        at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:79)
        at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:114)
        at org.codehaus.xfire.client.Client.invoke(Client.java:336)
        at 
org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
        at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
        at $Proxy9.faultIfLessZero(Unknown Source)
...

This is with XFire 1.2.6, embedded Jetty, Aegis binding, JSR181
annotations and client API approach. My service interface declares
checked exceptions, like so:

  public int faultIfLessZero(
    @WebParam(name = "sessionId") long sessionId,
    @WebParam(name = "i") int i)
    throws MintTestFaultException;

And the exception extends XFireFault (which did not make a difference, I
had the same results when it extended just Exception):

@WebFault(name = "TestFault")
public class MintTestFaultException extends XFireFault { public MintTestFaultException(String message) {
    super(message, RECEIVER);
  }
}

The @WebFault annotation does not seem to make any difference either.
The WSDL looks the same, as far as I can tell. If my service
implementation throws that exception I get the following outgoing
message on the server:

<?xml version="1.0" encoding="UTF-8"?>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>less zero!</faultstring>
</soap:Fault>

Naturally, with the client API approach the client uses the exact same
service interface which declares a checked exception. An
XFireRuntimeException is thrown instead and no catch block considers
this. Clients have catch blocks for MintTestFaultException but those are
missed of course.

Is this as designed or am I doing something wrong?

Regards
Werner



---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to