Invocation inv = null;
Container container = null;
try {
Switch theSwitch = Switch.getSwitch();
InvocationManager invManager = theSwitch.getInvocationManager();
inv = (Invocation) invManager.getCurrentInvocation();
container = (Container) inv.container;
inv.method = wsUtil.getInvMethod(inv.getWebServiceTie(), context);
// Result can be null for some error cases. This will be
// handled by jaxrpc runtime so we don't treat it as an exception.
if( inv.method != null ) {
inv.setWebServiceMethod(inv.method);
if ( !container.authorize(inv) ) {
inv.exception = new Exception
("Client not authorized for invocation of "
+ inv.method);
}
} else {
inv.setWebServiceMethod(null);
}
} catch(Exception e) {
String errorMsg = "Error unmarshalling method " +
( (container != null ) ?
"for ejb " + container.getEjbDescriptor().getName() :
"" );
//issue 2422 -- UnmarshalException.initCause always
//throws IllegalStateException. Need to use 2-arg ctor.
inv.exception = new UnmarshalException(errorMsg, e);
}
if( inv.exception != null ) {
logger.log(Level.WARNING, "preEjbHandlerError", inv.exception);
wsUtil.throwSOAPFaultException(inv.exception.getMessage(),
context);
}
return true;