The processRequest method is invoked with an object that
implements com.sun.xml.rpc.spi.runtime.SOAPMessageContext.
When this method is called by the JAXRPCServletDelegate
(on the server side of jaxrpc servlet container invocation processing)
it must be called just before the call to implementor.getTie().handle(),
and at the time of the request message and the following properties
must have been set on the SOAPMessageContext.
com.sun.xml.rpc.server.http.MessageContextProperties.IMPLEMENTOR
This property must be set to the com.sun.xml.rpc.spi.runtime.Implementor
object corresponding to the target endpoint.
com.sun.xml.rpc.server.http.MessageContextProperties.HTTP_SERVLET_REQUEST
This property must be
set to the javax.servlet.http.HttpServletRequest object containing the
JAXRPC invocation.
com.sun.xml.rpc.server.http.MessageContextProperties.HTTP_SERVLET_RESPONSE
This property must be
set to the javax.servlet.http.HttpServletResponse object corresponding to
the JAXRPC invocation.
com.sun.xml.rpc.server.MessageContextProperties.HTTP_SERVLET_CONTEXT
This property must be
set to the javax.servlet.ServletContext object corresponding to web application
in which the JAXRPC servlet is running.
if(_logger.isLoggable(Level.FINE)){
_logger.fine("ws.processRequest");
}
final SOAPMessageContext finalMC = messageContext;
Implementor implementor = (Implementor) messageContext.getProperty( IMPLEMENTOR );
final Tie tie = implementor.getTie();
StreamingHandler handler = (StreamingHandler) implementor.getTie();
SOAPMessage request = finalMC.getMessage();
final ServerAuthContext sAC = config_.getAuthContext(handler,request);
boolean status = true;
try {
if (sAC != null) {
status = false;
// proceed to process message security
status = WebServiceSecurity.validateRequest(finalMC,sAC);
if (status) {
messageContext.setProperty(SERVER_AUTH_CONTEXT, sAC);
}
}
} catch (AuthException ae) {
_logger.log(Level.SEVERE, "ws.error_validate_request", ae);
throw new RuntimeException(ae);
} finally {
WebServiceSecurity.auditInvocation(messageContext, endpoint_, status);
}
if (status) {
// only do doAsPriv if SecurityManager in effect.
if (System.getSecurityManager() != null) {
// on this branch, the endpoint invocation and the
// processing of the response will be initiated from
// within the system handler delegate. delegate returns
// false so that dispatcher will not invoke the endpoint.
status = false;
try {
Subject.doAsPrivileged
(SecurityContext.getCurrent().getSubject(),
new PrivilegedExceptionAction() {
public Object run() throws Exception {
tie.handle(finalMC);
processResponse(finalMC);
return null;
}
}, null);
} catch (PrivilegedActionException pae) {
Throwable cause = pae.getCause();
if (cause instanceof AuthException){
_logger.log(Level.SEVERE, "ws.error_secure_response", cause);
}
RuntimeException re = null;
if (cause instanceof RuntimeException) {
re = (RuntimeException) cause;
} else {
re = new RuntimeException(cause);
}
throw re;
}
}
}
return status;