// and move the endpoint specific check down stream
if (isEjbEndpoint) {
Switch theSwitch = Switch.getSwitch();
InvocationManager invManager= theSwitch.getInvocationManager();
Invocation inv= (Invocation) invManager.getCurrentInvocation();
// one need to copy message here, otherwise the message may be
// consumed
inv.setMessage(request.getMessage().copy());
Exception ie = null;
Method m = null;
if (seiModel != null) {
JavaMethod jm = request.getMessage().getMethod(seiModel);
m = (jm != null) ? jm.getMethod() : null;
} else { // WebServiceProvider
WebServiceEndpoint endpoint = (WebServiceEndpoint)
map.get(PipeConstants.SERVICE_ENDPOINT);
EjbDescriptor ejbDescriptor = endpoint.getEjbComponentImpl();
if (ejbDescriptor != null) {
final String ejbImplClassName = ejbDescriptor.getEjbImplClassName();
if (ejbImplClassName != null) {
try {
m = (Method)AppservAccessController.doPrivileged
( new PrivilegedExceptionAction() {
public Object run() throws Exception {
ClassLoader loader =
Thread.currentThread().getContextClassLoader();
Class clazz =
Class.forName(ejbImplClassName, true, loader);
return clazz.getMethod("invoke",
new Class[] { Object.class });
}
});
} catch(PrivilegedActionException pae) {
throw new RuntimeException(pae.getException());
}
}
}
}
if (m != null) {
Container container = (Container) inv.container;
try {
inv.method = m;
if ( !container.authorize(inv) ) {
ie = new Exception
(localStrings.getLocalString
("enterprise.webservice.methodNotAuth",
"Client not authorized for invocation of {0}",
new Object[] { inv.method }) );
} else {
// Record the method on which the successful
// authorization check was performed.
inv.setWebServiceMethod(inv.method);
}
} catch(Exception e) {
String errorMsg = localStrings.getLocalString
( "enterprise.webservice.errorUnMarshalMethod",
"Error unmarshalling method for ejb {0}",
new Object[] { ejbName() });
ie = new UnmarshalException(errorMsg);
ie.initCause(e);
}
if ( ie != null ) {
inv.exception = ie;
throw ie;
}
} else {
inv.setWebServiceMethod(null);
}
}
return;
}