-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I have this code (for testing):

@Action(fault = [EMAIL PROTECTED](className = WebServiceException.class)})
    public Object[] invoke(@WebParam(name = "parameters")
    final Map<String, String> parameters) throws WebServiceException {

        throw new WebServiceException("200", "Blobby");
    }

WebServiceException is defined as follows:

public class WebServiceException extends Exception {
    private static final long serialVersionUID = 1L;
    private final String faultCode;

    public WebServiceException(final String faultCode, final String
message) {
        super(message);
        this.faultCode = faultCode;
    }

    public String getFaultCode() {
        return faultCode;
    }
}

In my client I have this:

 public static void main(final String[] args) {
        final Service serviceModel = new
AnnotationServiceFactory().create(RouterServiceImpl.class);
        try {
            final RouterService service = (RouterService)new
XFireProxyFactory().create(serviceModel,
"http://localhost:5080/foobar/services/RouterService";);
            final Map<String, String> parameters = new HashMap<String,
String>();
            parameters.put("hello", "world");
            final Object[] objects = service.invoke(parameters);
            for(final Object o : objects) {
                System.out.println((String)o);
            }
        } catch(final MalformedURLException e) {
            e.printStackTrace();
        } catch(final WebServiceException e) {
            System.out.println(e.getFaultCode());
        }
    }


When I run the code I get this:dub

Exception in thread "main" org.codehaus.xfire.XFireRuntimeException:
Could not invoke service.. Nested exception is
org.codehaus.xfire.fault.XFireFault: Could not receive fault.. Nested
exception is org.codehaus.xfire.fault.XFireFault: Couldn't instantiate
class. uk.co.foobar.nexus.webservice.WebServiceException
org.codehaus.xfire.fault.XFireFault: Could not receive fault.. Nested
exception is org.codehaus.xfire.fault.XFireFault: Couldn't instantiate
class. uk.co.foobar.nexus.webservice.WebServiceException
        at org.codehaus.xfire.fault.XFireFault.createFault(XFireFault.java:89)
        at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:83)
        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 $Proxy6.invoke(Unknown Source)
        at com.stellestia.apps.WebService.main(WebService.java:22)
Caused by: org.codehaus.xfire.XFireRuntimeException: Could not receive
fault.. Nested exception is org.codehaus.xfire.fault.XFireFault:
Couldn't instantiate class.
uk.co.foobar.nexus.webservice.WebServiceException
        at org.codehaus.xfire.client.Client.onReceive(Client.java:431)
        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)
        ... 6 more
Caused by: org.codehaus.xfire.fault.XFireFault: Couldn't instantiate
class. uk.co.foobar.nexus.webservice.WebServiceException
        at
org.codehaus.xfire.aegis.type.basic.BeanType.readObject(BeanType.java:196)
        at
org.codehaus.xfire.aegis.AegisBindingProvider.readParameter(AegisBindingProvider.java:169)
        at
org.codehaus.xfire.client.ClientFaultConverter.processFaultDetail(ClientFaultConverter.java:51)
        at
org.codehaus.xfire.client.ClientFaultConverter.invoke(ClientFaultConverter.java:32)
        at
org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
        at org.codehaus.xfire.client.Client.onReceive(Client.java:424)
        ... 11 more
Caused by: java.lang.InstantiationException:
uk.co.foobar.nexus.webservice.WebServiceException
        at java.lang.Class.newInstance0(Class.java:340)
        at java.lang.Class.newInstance(Class.java:308)
        at
org.codehaus.xfire.aegis.type.basic.BeanType.createFromFault(BeanType.java:253)
        at
org.codehaus.xfire.aegis.type.basic.BeanType.readObject(BeanType.java:105)
        ... 16 more


I don't understand what I'm doing wrong. Can anyone shed light on how to
get an expection passed all the way back to the client (as a SOAP Fault
Code) so that I can deal with it (I know in the client that I can catch
this exception, but the client could be in Ruby for example...)

Thanks everyone!

- -=david=-

- --

"life would be so much easier if we had the source code"
PGP Key Id: 0xE2BE72FC
Public Key: http://www.harrigan.info/public.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGdlRJa5vShOK+cvwRAmFFAKDigHHesLQmYXyGSKCrA1JFT+NgrACgh82P
ovuXIZhOOQIVM76+dhNLCvU=
=1SJO
-----END PGP SIGNATURE-----

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

    http://xircles.codehaus.org/manage_email

Reply via email to