FileDocCategorySizeDatePackage
JAXWSMessageProcessor.javaAPI DocGlassfish v2 API5447Fri May 25 01:19:38 BST 2007com.sun.enterprise.jbi.serviceengine.bridge

JAXWSMessageProcessor

public class JAXWSMessageProcessor extends com.sun.enterprise.jbi.serviceengine.comm.MessageProcessor
Process new incoming messages from NMR and pass it to the JAX-WS layer for endpoint invocations. Processing always happen in a new thread.
author
Vikas Awasthi

Fields Summary
Constructors Summary
Methods Summary
private voiddebug(java.util.logging.Level logLevel, java.lang.String msgID, java.lang.Object[] params)

        logger.log(logLevel, msgID, params);
    
public voiddoWork()
Actual code that starts processing the MEP.

        try {
            // Add code here to process the received message.
            MessageExchange me = getMessageExchange();
            String endpointName = me.getEndpoint().getEndpointName();
            QName service = me.getEndpoint().getServiceName();

            String key = DescriptorEndpointInfo.getDEIKey(service, endpointName);
            DescriptorEndpointInfo dei = EndpointRegistry.getInstance().getWSDLEndpts().get(key);
            if(dei != null) {
                service = dei.getServiceName();
                endpointName = dei.getEndpointName();
            }
            JBIAdapterBuilder builder = new JBIAdapterBuilder();
            JBIAdapter jbiAdapter = null;
            
            try {
                debug(Level.FINE,"serviceengine.process_incoming_request",
                        new Object[]{service.getLocalPart(), endpointName});
                
                jbiAdapter = builder.createAdapter(service,endpointName,me);
                
                Thread curThread = Thread.currentThread();
                if (jbiAdapter != null) {
                    ClassLoader currentLoader =
                            curThread.getContextClassLoader();
                    try {
                        // do we need to perform security checks here?
                        curThread.setContextClassLoader(jbiAdapter.getClassLoader());
                        // call to invoke the endpoint
                        jbiAdapter.handle();
                    } finally {
                        curThread.setContextClassLoader(currentLoader);
                    }
                } else
                    logger.log(Level.WARNING, "Endpoint ["+endpointName+"] not registered");
                
                debug(Level.FINE,"serviceengine.success_incoming_request",
                        new Object[]{service.getLocalPart(), endpointName});
                
            } catch(Throwable e) {
                logger.log(Level.SEVERE, "serviceengine.error_incoming_request", e);
                ServiceEngineException seException = new ServiceEngineException(e);
                if(jbiAdapter != null) {
                    jbiAdapter.handleException(seException);
                }
            }
        } catch(Exception e) {
            logger.log(Level.SEVERE, "JavaEEServiceEngine : Error processing request" + e  , e);
        }
    
public voidprocess()
MessageAcceptor uses this method to start processing the MEP.

        execute();