Package com.sun.xml.rpc.spi.runtime

Examples of com.sun.xml.rpc.spi.runtime.SOAPMessageContext


  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) {
View Full Code Here


        throws IOException, SOAPException
    {
       
        JAXRPCEndpointImpl endpoint = null;              
        String messageID = null;
        SOAPMessageContext msgContext = null;
       
        try {
           
            MimeHeaders headers = wsUtil.getHeaders(req);
           
            if (!wsUtil.hasTextXmlContentType(headers)) {
                wsUtil.writeInvalidContentType(resp);
               
                return;
            }
           
            msgContext = rpcFactory.createSOAPMessageContext();
            SOAPMessage message = createSOAPMessage(req, headers);
                       
      ServerAuthContext sAC = null;
      boolean wssSucceded = true;
           
            if (message != null) {                               
               
                msgContext.setMessage(message);

                // get the endpoint info
                endpoint = (JAXRPCEndpointImpl) endpointInfo.getEndpoint().getExtraAttribute(EndpointImpl.NAME);
               
                if (endpoint!=null) {
                    // first global notification
                    if (wsEngine.hasGlobalMessageListener()) {
                        messageID = wsEngine.preProcessRequest(endpoint);
                    }
                } else {
                    logger.fine("Missing internal monitoring info to trace " + req.getRequestURI());
                }                                  
               
                Handler implementor = null;
                try {
                    Ejb2RuntimeEndpointInfo endpointInfo2 = (Ejb2RuntimeEndpointInfo)endpointInfo;
                    // Do ejb container pre-invocation and pre-handler
                    // logic
                    implementor = endpointInfo2.getHandlerImplementor(msgContext);

                    // Set http request object
                    msgContext.setProperty(HTTP_SERVLET_REQUEST, req);
                    // Set http response object so one-way operations will
                    // response before actual business method invocation.
                    msgContext.setProperty(HTTP_SERVLET_RESPONSE, resp);
                   
        ServerAuthConfig authConfig = endpointInfo2.getServerAuthConfig();
        if (authConfig != null) {
      sAC = authConfig.getAuthContext
          ((StreamingHandler)implementor,message);
      if (sAC != null) {
          wssSucceded =
        WebServiceSecurity.validateRequest(msgContext,sAC);
      }
        }

                    // Trace if necessary
                    if (messageID!=null || (endpoint!=null && endpoint.hasListeners())) {
                        // create the thread local
                        ThreadLocalInfo threadLocalInfo =
                            new ThreadLocalInfo(messageID, req);

                        wsEngine.getThreadLocal().set(threadLocalInfo);

                        endpoint.processRequest(msgContext);
                    }
                   
                    // Pass control back to jaxrpc runtime to invoke
                    // any handlers and call the webservice method itself,
                    // which will be flow back into the ejb container.
        if (wssSucceded) {
      implementor.handle(msgContext);
        }
                   
                } finally {
                   
                    // Always call release, even if an error happened
                    // during getImplementor(), since some of the
                    // preInvoke steps might have occurred.  It's ok
                    // if implementor is null.
                    endpointInfo.releaseImplementor();

                }
            } else {               
                String errorMsg = "null message POSTed to ejb endpoint " +
                endpointInfo.getEndpoint().getEndpointName() +
                " at " + endpointInfo.getEndpointAddressUri();
                logger.fine(errorMsg);
                msgContext.writeSimpleErrorResponse
                (FAULT_CODE_CLIENT, errorMsg);
            }
           
            if (messageID!=null || endpoint!=null) {
                endpoint.processResponse(msgContext);
            }
               
            SOAPMessage reply = msgContext.getMessage();
           
      if (sAC != null && wssSucceded) {
    WebServiceSecurity.secureResponse(msgContext,sAC);
      }
           
            if (reply.saveRequired()) {
                reply.saveChanges();
            }

            wsUtil.writeReply(resp, msgContext);
           

        } catch (Throwable e) {
           
            String errorMessage = "invocation error on ejb endpoint " +
            endpointInfo.getEndpoint().getEndpointName() + " at " +
            endpointInfo.getEndpointAddressUri();
            logger.log(Level.WARNING, errorMessage, e);
           
            SOAPMessageContext errorMsgContext =
            rpcFactory.createSOAPMessageContext();
            errorMsgContext.writeSimpleErrorResponse
            (SOAPConstants.FAULT_CODE_SERVER, errorMessage);
           
            resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
            if (messageID!=null || endpoint!=null) {       
                endpoint.processResponse(errorMsgContext);
View Full Code Here

        byte[] bytes = readFully(is);
        int length = request.getContentLength() == -1 ? bytes.length
            : request.getContentLength();
        ByteInputStream in = new ByteInputStream(bytes, length);

        SOAPMessageContext msgContext = rpcFactory.createSOAPMessageContext();
        SOAPMessage message = msgContext.createMessage(headers, in);

        return message;
    }
View Full Code Here

    private SOAPMessage processEJBRequest(SOAPMessage message,
            EjbRuntimeEndpointInfo endpointInfo) {
       
        if (message != null) {
            Container container = endpointInfo.getContainer();
            SOAPMessageContext msgContext = rpcFactory.createSOAPMessageContext();
            // Set context class loader to application class loader
            container.externalPreInvoke();
            msgContext.setMessage(message);
           
            try {
                // Do ejb container pre-invocation and pre-handler
                // logic
                Handler implementor = ((Ejb2RuntimeEndpointInfo) endpointInfo).getHandlerImplementor(msgContext);
               
                // Pass control back to jaxrpc runtime to invoke
                // any handlers and call the webservice method itself,
                // which will be flow back into the ejb container.
                implementor.handle(msgContext);
              
                SOAPMessage reply = msgContext.getMessage();
               
                if (reply.saveRequired()) {
                    reply.saveChanges();
                }
                return reply;
View Full Code Here

  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) {
View Full Code Here

                            EjbRuntimeEndpointInfo endpointInfo)
        throws IOException, SOAPException {
       
        JAXRPCEndpointImpl endpoint = null;              
        String messageID = null;
        SOAPMessageContext msgContext = null;
       
        try {
           
            MimeHeaders headers = wsUtil.getHeaders(req);
            if (!wsUtil.hasTextXmlContentType(headers)) {
                wsUtil.writeInvalidContentType(resp);
                return;
            }
           
            msgContext = rpcFactory.createSOAPMessageContext();
            SOAPMessage message = createSOAPMessage(req, headers);
                       
          boolean wssSucceded = true;
           
            if (message != null) {                               
               
                msgContext.setMessage(message);

                // get the endpoint info
                endpoint = (JAXRPCEndpointImpl) endpointInfo.getEndpoint().getExtraAttribute(EndpointImpl.NAME);
               
                if (endpoint!=null) {
                    // first global notification
                    if (wsEngine.hasGlobalMessageListener()) {
                        messageID = wsEngine.preProcessRequest(endpoint);
                    }
                } else {
                    if (logger.isLoggable(Level.FINE)) {
                        logger.log(Level.FINE, LogUtils.MISSING_MONITORING_INFO, req.getRequestURI());
                    }
                }                                  
               
                AdapterInvocationInfo aInfo = null;
               
                if (!(endpointInfo instanceof Ejb2RuntimeEndpointInfo)) {
                    throw new IllegalArgumentException(endpointInfo + "is not instance of Ejb2RuntimeEndpointInfo.");
                }

                try {
                    Ejb2RuntimeEndpointInfo endpointInfo2 = (Ejb2RuntimeEndpointInfo)endpointInfo;
                    // Do ejb container pre-invocation and pre-handler
                    // logic
                    aInfo = endpointInfo2.getHandlerImplementor();

                    // Set message context in invocation
                    EJBInvocation.class.cast(aInfo.getInv()).setMessageContext(msgContext);


                    // Set http response object so one-way operations will
                    // response before actual business method invocation.
                    msgContext.setProperty(HTTP_SERVLET_RESPONSE, resp);
                    if (secServ != null) {
                        wssSucceded = secServ.validateRequest(endpointInfo2.getServerAuthConfig(),
                                (StreamingHandler)aInfo.getHandler(), msgContext);
                    }
                    // Trace if necessary
                    if (messageID!=null || (endpoint!=null && endpoint.hasListeners())) {
                        // create the thread local
                        ThreadLocalInfo threadLocalInfo = new ThreadLocalInfo(messageID, req);
                        wsEngine.getThreadLocal().set(threadLocalInfo);
                        if (endpoint != null) {
                            endpoint.processRequest(msgContext);
                        } else {
                            if (logger.isLoggable(Level.FINE)) {
                                logger.log(Level.FINE, LogUtils.MISSING_MONITORING_INFO, req.getRequestURI());
                            }
                        }
                    }
                   
                    // Pass control back to jaxrpc runtime to invoke
                    // any handlers and call the webservice method itself,
                    // which will be flow back into the ejb container.
                    if (wssSucceded) {
                        aInfo.getHandler().handle(msgContext);
                    }
                } finally {
                    // Always call release, even if an error happened
                    // during getImplementor(), since some of the
                    // preInvoke steps might have occurred.  It's ok
                    // if implementor is null.
                    if (aInfo != null) {
                        endpointInfo.releaseImplementor(aInfo.getInv());
                    }
                }
            } else {
                String errorMsg = MessageFormat.format(
                        logger.getResourceBundle().getString(LogUtils.NULL_MESSAGE),
                        endpointInfo.getEndpoint().getEndpointName(), endpointInfo.getEndpointAddressUri());
                    if (logger.isLoggable(Level.FINE)) {
                        logger.fine(errorMsg);
                    }
                    msgContext.writeSimpleErrorResponse
                    (FAULT_CODE_CLIENT, errorMsg);
            }
            if (messageID!=null || endpoint!=null) {
                endpoint.processResponse(msgContext);
            }
            SOAPMessage reply = msgContext.getMessage();
            if (secServ != null && wssSucceded) {
                if (!(endpointInfo instanceof Ejb2RuntimeEndpointInfo)) {
                    throw new IllegalArgumentException(endpointInfo + "is not instance of Ejb2RuntimeEndpointInfo.");
                }

                Ejb2RuntimeEndpointInfo endpointInfo2 = (Ejb2RuntimeEndpointInfo)endpointInfo;
                secServ.secureResponse(endpointInfo2.getServerAuthConfig(),(StreamingHandler)endpointInfo2.getHandlerImplementor().getHandler(),msgContext);
            }
           
            if (reply.saveRequired()) {
                reply.saveChanges();
            }
            wsUtil.writeReply(resp, msgContext);
        } catch (Throwable e) {
            String errorMessage = MessageFormat.format(
                    logger.getResourceBundle().getString(LogUtils.ERROR_ON_EJB),
                    new Object[] {endpointInfo.getEndpoint().getEndpointName(),
                        endpointInfo.getEndpointAddressUri(), e.getMessage()});
            logger.log(Level.WARNING, errorMessage, e);
            SOAPMessageContext errorMsgContext =
                rpcFactory.createSOAPMessageContext();
            errorMsgContext.writeSimpleErrorResponse
                (SOAPConstants.FAULT_CODE_SERVER, errorMessage);
            resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
            if (messageID!=null || endpoint!=null) {
                endpoint.processResponse(errorMsgContext);
            }
View Full Code Here

        byte[] bytes = readFully(is);
        int length = request.getContentLength() == -1 ? bytes.length
            : request.getContentLength();
        ByteInputStream in = new ByteInputStream(bytes, length);

        SOAPMessageContext msgContext = rpcFactory.createSOAPMessageContext();
        SOAPMessage message = msgContext.createMessage(headers, in);

        return message;
    }
View Full Code Here

                            EjbRuntimeEndpointInfo endpointInfo)
        throws IOException, SOAPException {
       
        JAXRPCEndpointImpl endpoint = null;              
        String messageID = null;
        SOAPMessageContext msgContext = null;
       
        try {
           
            MimeHeaders headers = wsUtil.getHeaders(req);
            if (!wsUtil.hasTextXmlContentType(headers)) {
                wsUtil.writeInvalidContentType(resp);
                return;
            }
           
            msgContext = rpcFactory.createSOAPMessageContext();
            SOAPMessage message = createSOAPMessage(req, headers);
                       
          boolean wssSucceded = true;
           
            if (message != null) {                               
               
                msgContext.setMessage(message);

                // get the endpoint info
                endpoint = (JAXRPCEndpointImpl) endpointInfo.getEndpoint().getExtraAttribute(EndpointImpl.NAME);
               
                if (endpoint!=null) {
                    // first global notification
                    if (wsEngine.hasGlobalMessageListener()) {
                        messageID = wsEngine.preProcessRequest(endpoint);
                    }
                } else {
                    logger.fine("Missing internal monitoring info to trace " + req.getRequestURI());
                }                                  
               
                AdapterInvocationInfo aInfo = null;
               
                if (!(endpointInfo instanceof Ejb2RuntimeEndpointInfo)) {
                    throw new IllegalArgumentException(endpointInfo + "is not instance of Ejb2RuntimeEndpointInfo.");
                }

                try {
                    Ejb2RuntimeEndpointInfo endpointInfo2 = (Ejb2RuntimeEndpointInfo)endpointInfo;
                    // Do ejb container pre-invocation and pre-handler
                    // logic
                    aInfo = endpointInfo2.getHandlerImplementor();

                    // Set message context in invocation
                    ((EJBInvocation) aInfo.getInv()).setMessageContext(msgContext);


                    // Set http response object so one-way operations will
                    // response before actual business method invocation.
                    msgContext.setProperty(HTTP_SERVLET_RESPONSE, resp);
                    if (secServ != null) {
                        wssSucceded = secServ.validateRequest(endpointInfo2.getServerAuthConfig(),
                                (StreamingHandler)aInfo.getHandler(), msgContext);
                    }
                    // Trace if necessary
                    if (messageID!=null || (endpoint!=null && endpoint.hasListeners())) {
                        // create the thread local
                        ThreadLocalInfo threadLocalInfo = new ThreadLocalInfo(messageID, req);
                        wsEngine.getThreadLocal().set(threadLocalInfo);
                        endpoint.processRequest(msgContext);
                    }
                   
                    // Pass control back to jaxrpc runtime to invoke
                    // any handlers and call the webservice method itself,
                    // which will be flow back into the ejb container.
                    if (wssSucceded) {
                        aInfo.getHandler().handle(msgContext);
                    }
                } finally {
                    // Always call release, even if an error happened
                    // during getImplementor(), since some of the
                    // preInvoke steps might have occurred.  It's ok
                    // if implementor is null.
                    if (aInfo != null) {
                        endpointInfo.releaseImplementor(aInfo.getInv());
                    }
                }
            } else {
                String errorMsg = "null message POSTed to ejb endpoint " +
                    endpointInfo.getEndpoint().getEndpointName() +
                    " at " + endpointInfo.getEndpointAddressUri();
                    logger.fine(errorMsg);
                    msgContext.writeSimpleErrorResponse
                    (FAULT_CODE_CLIENT, errorMsg);
            }
            if (messageID!=null || endpoint!=null) {
                endpoint.processResponse(msgContext);
            }
            SOAPMessage reply = msgContext.getMessage();
            if (secServ != null && wssSucceded) {
                if (!(endpointInfo instanceof Ejb2RuntimeEndpointInfo)) {
                    throw new IllegalArgumentException(endpointInfo + "is not instance of Ejb2RuntimeEndpointInfo.");
                }

                Ejb2RuntimeEndpointInfo endpointInfo2 = (Ejb2RuntimeEndpointInfo)endpointInfo;
                secServ.secureResponse(endpointInfo2.getServerAuthConfig(),(StreamingHandler)endpointInfo2.getHandlerImplementor().getHandler(),msgContext);
            }
           
            if (reply.saveRequired()) {
                reply.saveChanges();
            }
            wsUtil.writeReply(resp, msgContext);
        } catch (Throwable e) {
            String errorMessage = "invocation error on ejb endpoint " +
                endpointInfo.getEndpoint().getEndpointName() + " at " +
                endpointInfo.getEndpointAddressUri();
                logger.log(Level.WARNING, errorMessage, e);
            SOAPMessageContext errorMsgContext =
                rpcFactory.createSOAPMessageContext();
            errorMsgContext.writeSimpleErrorResponse
                (SOAPConstants.FAULT_CODE_SERVER, errorMessage);
            resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
            if (messageID!=null || endpoint!=null) {
                endpoint.processResponse(errorMsgContext);
            }
View Full Code Here

        byte[] bytes = readFully(is);
        int length = request.getContentLength() == -1 ? bytes.length
            : request.getContentLength();
        ByteInputStream in = new ByteInputStream(bytes, length);

        SOAPMessageContext msgContext = rpcFactory.createSOAPMessageContext();
        SOAPMessage message = msgContext.createMessage(headers, in);

        return message;
    }
View Full Code Here

                            EjbRuntimeEndpointInfo endpointInfo)
        throws IOException, SOAPException {
       
        JAXRPCEndpointImpl endpoint = null;              
        String messageID = null;
        SOAPMessageContext msgContext = null;
       
        try {
           
            MimeHeaders headers = wsUtil.getHeaders(req);
            if (!wsUtil.hasTextXmlContentType(headers)) {
                wsUtil.writeInvalidContentType(resp);
                return;
            }
           
            msgContext = rpcFactory.createSOAPMessageContext();
            SOAPMessage message = createSOAPMessage(req, headers);
                       
          boolean wssSucceded = true;
           
            if (message != null) {                               
               
                msgContext.setMessage(message);

                // get the endpoint info
                endpoint = (JAXRPCEndpointImpl) endpointInfo.getEndpoint().getExtraAttribute(EndpointImpl.NAME);
               
                if (endpoint!=null) {
                    // first global notification
                    if (wsEngine.hasGlobalMessageListener()) {
                        messageID = wsEngine.preProcessRequest(endpoint);
                    }
                } else {
                    logger.fine("Missing internal monitoring info to trace " + req.getRequestURI());
                }                                  
               
                AdapterInvocationInfo aInfo = null;
                try {
                    Ejb2RuntimeEndpointInfo endpointInfo2 = (Ejb2RuntimeEndpointInfo)endpointInfo;
                    // Do ejb container pre-invocation and pre-handler
                    // logic
                    aInfo = endpointInfo2.getHandlerImplementor();

                    // Set message context in invocation
                    ((EJBInvocation) aInfo.getInv()).setMessageContext(msgContext);


                    // Set http response object so one-way operations will
                    // response before actual business method invocation.
                    msgContext.setProperty(HTTP_SERVLET_RESPONSE, resp);
                    if (secServ != null) {
                        wssSucceded = secServ.validateRequest(endpointInfo2.getServerAuthConfig(),
                                (StreamingHandler)aInfo.getHandler(), msgContext);
                    }
                    // Trace if necessary
                    if (messageID!=null || (endpoint!=null && endpoint.hasListeners())) {
                        // create the thread local
                        ThreadLocalInfo threadLocalInfo = new ThreadLocalInfo(messageID, req);
                        wsEngine.getThreadLocal().set(threadLocalInfo);
                        endpoint.processRequest(msgContext);
                    }
                   
                    // Pass control back to jaxrpc runtime to invoke
                    // any handlers and call the webservice method itself,
                    // which will be flow back into the ejb container.
                    if (wssSucceded) {
                        aInfo.getHandler().handle(msgContext);
                    }
                } finally {
                    // Always call release, even if an error happened
                    // during getImplementor(), since some of the
                    // preInvoke steps might have occurred.  It's ok
                    // if implementor is null.
                    endpointInfo.releaseImplementor(aInfo.getInv());
                }
            } else {
                String errorMsg = "null message POSTed to ejb endpoint " +
                    endpointInfo.getEndpoint().getEndpointName() +
                    " at " + endpointInfo.getEndpointAddressUri();
                    logger.fine(errorMsg);
                    msgContext.writeSimpleErrorResponse
                    (FAULT_CODE_CLIENT, errorMsg);
            }
            if (messageID!=null || endpoint!=null) {
                endpoint.processResponse(msgContext);
            }
            SOAPMessage reply = msgContext.getMessage();
            if (secServ != null && wssSucceded) {
                Ejb2RuntimeEndpointInfo endpointInfo2 = (Ejb2RuntimeEndpointInfo)endpointInfo;
                secServ.secureResponse(endpointInfo2.getServerAuthConfig(),(StreamingHandler)endpointInfo2.getHandlerImplementor().getHandler(),msgContext);
            }
           
            if (reply.saveRequired()) {
                reply.saveChanges();
            }
            wsUtil.writeReply(resp, msgContext);
        } catch (Throwable e) {
            String errorMessage = "invocation error on ejb endpoint " +
                endpointInfo.getEndpoint().getEndpointName() + " at " +
                endpointInfo.getEndpointAddressUri();
                logger.log(Level.WARNING, errorMessage, e);
            SOAPMessageContext errorMsgContext =
                rpcFactory.createSOAPMessageContext();
            errorMsgContext.writeSimpleErrorResponse
                (SOAPConstants.FAULT_CODE_SERVER, errorMessage);
            resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
            if (messageID!=null || endpoint!=null) {
                endpoint.processResponse(errorMsgContext);
            }
View Full Code Here

TOP

Related Classes of com.sun.xml.rpc.spi.runtime.SOAPMessageContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.