> I'm away to Paris this weekend but I'll send you some more information
> on Tuesday when I return.

After a wonderful weekend (and not so wonderful week) here's the second
part :-).  Sorry for the delay.

As mentioned last week I have my own version of the EJBProvider.  My
provider catches exceptions that occur when the call is made to the
session bean and wraps them in an AxisFault before the JavaProvider
steps in.

I have modified the wsdl2java generator to include code on the client
side to unwrap these exception and throw them if they are expected.

The server side looks like this: -

    final Object serviceObj =
((OrchardEJBSessionServiceLifecycle)obj).getServiceObject() ;
    try
    {
        return super.invokeMethod(messageContext, method, serviceObj, args)
;
    }
    catch (final InvocationTargetException ite)
    {
        throw makeAxisFault(ite, messageContext) ;
    }

where makeAxisFault serialises the exception and creates an AxisFault with
the result as a detail element.

The client side looks like this: -
    try
    {
        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {in0});

        if (_resp instanceof java.rmi.RemoteException) {
            throw (java.rmi.RemoteException)_resp;
        }
    }
    catch (final org.apache.axis.AxisFault fault)
    {
        final Throwable origException =
uk.co.orchardsystems.soap.client.OrchardSerialisationHelper.deserialiseFault
(_call.getMessageContext(), fault) ;
        if (origException != null)
        {
            if (origException instanceof
uk.co.orchardsystems.security.client.OrchardSecurityCreateException)
            {
                throw
(uk.co.orchardsystems.security.client.OrchardSecurityCreateException)origExc
eption ;
            }
            if (origException instanceof
uk.co.orchardsystems.security.client.OrchardSecuritySystemException)
            {
                throw
(uk.co.orchardsystems.security.client.OrchardSecuritySystemException)origExc
eption ;
            }
            if (origException instanceof java.lang.SecurityException)
            {
                throw (java.lang.SecurityException)origException ;
            }
        }
        throw fault ;
    }

The soap looks like this: -

 <?xml version="1.0" encoding="UTF-8"?>
 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
  <soapenv:Body>
   <soapenv:Fault>
    <faultcode
xmlns:ns1="http://xml.apache.org/axis/";>ns1:Server.userException</faultcode>
    <faultstring>Authentication exception, principal=orchard</faultstring>
    <detail>
     <ns1:exception xsi:type="ns1:java.lang.SecurityException"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:ns1="http://www.orchard-systems.co.uk/wsdl/types";>
      <message xsi:type="xsd:string"
xmlns:xsd="http://www.w3.org/2001/XMLSchema";>Authentication exception,
principal=orchard</message>
     </ns1:exception>
    </detail>
   </soapenv:Fault>
  </soapenv:Body>
 </soapenv:Envelope>

The only part I am unsure about is the format of the soap request
but I believe it is correct from my reading of the spec.

The other thing to watch out for is that the axis code has a bug that
does not correctly generate the wsdl for exception classes nor serialise
them properly.  I have had to replace their serialiser/deserialiser with
one of my own.  I can shed more on this later if it has not already been
fixed.

HTH,
        Kev

Kevin Conner
This is a personal e-mail. Any views or opinions presented are 
solely those of the author and do not necessarily represent those 
of Orchard Information Systems Ltd.


-------------------------------------------------------
This SF.NET email is sponsored by: FREE  SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your  SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to