Package org.jboss.wsf.spi.invocation

Examples of org.jboss.wsf.spi.invocation.HandlerCallback


      if (msgContext == null)
      {
         throw new IllegalStateException("Cannot obtain MessageContext");
      }

      final HandlerCallback callback = wsInvocation.getInvocationContext().getAttachment(HandlerCallback.class);
      if (callback == null)
      {
         throw new IllegalStateException("Cannot obtain HandlerCallback");
      }
View Full Code Here


         // not for us
         return this.getNext().invoke(jbossInvocation);
      }

      final Invocation wsInvocation = (Invocation) jbossInvocation.getValue(Invocation.class.getName());
      final HandlerCallback callback = (HandlerCallback) jbossInvocation.getValue(HandlerCallback.class.getName());

      if (callback == null || wsInvocation == null)
      {
         log.warn("Handler callback not available");
         return this.getNext().invoke(jbossInvocation);
      }

      // Handlers need to be Tx. Therefore we must invoke the handler chain after the TransactionInterceptor.
      try
      {
         // call the request handlers
         boolean handlersPass = callback.callRequestHandlerChain(wsInvocation, HandlerType.ENDPOINT);
         handlersPass = handlersPass && callback.callRequestHandlerChain(wsInvocation, HandlerType.POST);

         // Call the next interceptor in the chain
         if (handlersPass)
         {
            // The SOAPContentElements stored in the EndpointInvocation might have changed after
            // handler processing. Get the updated request payload. This should be a noop if request
            // handlers did not modify the incomming SOAP message.
            final Object[] reqParams = wsInvocation.getArgs();
            jbossInvocation.setArguments(reqParams);
            final Object resObj = this.getNext().invoke(jbossInvocation);

            // Setting the message to null should trigger binding of the response message
            msgContext.setMessage(null);
            wsInvocation.setReturnValue(resObj);
         }

         // call the response handlers
         handlersPass = callback.callResponseHandlerChain(wsInvocation, HandlerType.POST);
         handlersPass = handlersPass && callback.callResponseHandlerChain(wsInvocation, HandlerType.ENDPOINT);

         // update the return value after response handler processing
         return wsInvocation.getReturnValue();
      }
      catch (Exception ex)
      {
         try
         {
            // call the fault handlers
            boolean handlersPass = callback.callFaultHandlerChain(wsInvocation, HandlerType.POST, ex);
            handlersPass = handlersPass && callback.callFaultHandlerChain(wsInvocation, HandlerType.ENDPOINT, ex);
         }
         catch (Exception e)
         {
            log.warn("Cannot process handlerChain.handleFault, ignoring: ", e);
         }
View Full Code Here

        @Override
        public Object processInvocation(final InterceptorContext context) throws Exception {
            final SOAPMessageContext msgContext = (SOAPMessageContext) context.getPrivateData(MessageContext.class);
            final Invocation wsInvocation = (Invocation) context.getPrivateData(Invocation.class);
            final HandlerCallback callback = (HandlerCallback) context.getPrivateData(HandlerCallback.class);
            if (msgContext == null || callback == null || wsInvocation == null) {
                // not for us
                return context.proceed();
            }

            // Handlers need to be Tx. Therefore we must invoke the handler chain after the TransactionInterceptor.
            try {
                // call the request handlers
                boolean handlersPass = callback.callRequestHandlerChain(wsInvocation, HandlerType.ENDPOINT);
                handlersPass = handlersPass && callback.callRequestHandlerChain(wsInvocation, HandlerType.POST);

                // Call the next interceptor in the chain
                if (handlersPass) {
                    // The SOAPContentElements stored in the EndpointInvocation might have changed after
                    // handler processing. Get the updated request payload. This should be a noop if request
                    // handlers did not modify the incomming SOAP message.
                    final Object[] reqParams = wsInvocation.getArgs();
                    context.setParameters(reqParams);
                    final Object resObj = context.proceed();

                    // Setting the message to null should trigger binding of the response message
                    msgContext.setMessage(null);
                    wsInvocation.setReturnValue(resObj);
                }

                // call the response handlers
                handlersPass = callback.callResponseHandlerChain(wsInvocation, HandlerType.POST);
                handlersPass = handlersPass && callback.callResponseHandlerChain(wsInvocation, HandlerType.ENDPOINT);

                // update the return value after response handler processing
                return wsInvocation.getReturnValue();
            }
            catch (final Exception ex) {
                try {
                    // call the fault handlers
                    boolean handlersPass = callback.callFaultHandlerChain(wsInvocation, HandlerType.POST, ex);
                    handlersPass = handlersPass && callback.callFaultHandlerChain(wsInvocation, HandlerType.ENDPOINT, ex);
                }
                catch (Exception ignore) {}
                throw ex;
            }
        }
View Full Code Here

final class InvocationHandlerEJB21 extends AbstractInvocationHandlerEJB {

    @Override
    protected void prepareForInvocation(final InterceptorContext context, final Invocation wsInvocation) {
        final MessageContext msgContext = wsInvocation.getInvocationContext().getAttachment(MessageContext.class);
        final HandlerCallback callback = wsInvocation.getInvocationContext().getAttachment(HandlerCallback.class);
        context.putPrivateData(MessageContext.class, msgContext);
        context.putPrivateData(HandlerCallback.class, callback);
        context.putPrivateData(Invocation.class, wsInvocation);
    }
View Full Code Here

      // Get the endpoint invocation
      Invocation wsInv = (Invocation)jbInv.getValue(Invocation.class.getName());

      // Get the handler callback
      HandlerCallback callback = (HandlerCallback)jbInv.getValue(HandlerCallback.class.getName());

      // Handlers need to be Tx. Therefore we must invoke the handler chain after the TransactionInterceptor.
      if (callback != null && wsInv != null)
      {
         try
         {
            // call the request handlers
            boolean handlersPass = callback.callRequestHandlerChain(wsInv, HandlerType.ENDPOINT);
            handlersPass = handlersPass && callback.callRequestHandlerChain(wsInv, HandlerType.POST);

            // Call the next interceptor in the chain
            if (handlersPass)
            {
               // The SOAPContentElements stored in the EndpointInvocation might have changed after
               // handler processing. Get the updated request payload. This should be a noop if request
               // handlers did not modify the incomming SOAP message.
               Object[] reqParams = wsInv.getArgs();
               jbInv.setArguments(reqParams);
               Object resObj = getNext().invoke(jbInv);

               // Setting the message to null should trigger binding of the response message
               msgContext.setMessage(null);
               wsInv.setReturnValue(resObj);
            }

            // call the response handlers
            handlersPass = callback.callResponseHandlerChain(wsInv, HandlerType.POST);
            handlersPass = handlersPass && callback.callResponseHandlerChain(wsInv, HandlerType.ENDPOINT);

            // update the return value after response handler processing
            Object resObj = wsInv.getReturnValue();

            return resObj;
         }
         catch (Exception ex)
         {
            try
            {
               // call the fault handlers
               boolean handlersPass = callback.callFaultHandlerChain(wsInv, HandlerType.POST, ex);
               handlersPass = handlersPass && callback.callFaultHandlerChain(wsInv, HandlerType.ENDPOINT, ex);
            }
            catch (Exception subEx)
            {
               log.warn("Cannot process handlerChain.handleFault, ignoring: ", subEx);
            }
View Full Code Here

      Method method = inv.getJavaMethod();
      Object[] args = inv.getArgs();
      org.jboss.invocation.Invocation jbInv = new org.jboss.invocation.Invocation(null, method, args, null, principal, credential);

      HandlerCallback callback = inv.getInvocationContext().getAttachment(HandlerCallback.class);
      if (callback == null)
         throw new IllegalStateException("Cannot obtain HandlerCallback");

      jbInv.setValue(InvocationKey.SOAP_MESSAGE_CONTEXT, msgContext);
      jbInv.setValue(InvocationKey.SOAP_MESSAGE, ((SOAPMessageContext)msgContext).getMessage());
View Full Code Here

      // Get the endpoint invocation
      Invocation wsInv = (Invocation)jbInv.getValue(Invocation.class.getName());

      // Get the handler callback
      HandlerCallback callback = (HandlerCallback)jbInv.getValue(HandlerCallback.class.getName());

      // Handlers need to be Tx. Therefore we must invoke the handler chain after the TransactionInterceptor.
      if (callback != null && wsInv != null)
      {
         try
         {
            // call the request handlers
            boolean handlersPass = callback.callRequestHandlerChain(wsInv, HandlerType.ENDPOINT);
            handlersPass = handlersPass && callback.callRequestHandlerChain(wsInv, HandlerType.POST);

            // Call the next interceptor in the chain
            if (handlersPass)
            {
               // The SOAPContentElements stored in the EndpointInvocation might have changed after
               // handler processing. Get the updated request payload. This should be a noop if request
               // handlers did not modify the incomming SOAP message.
               Object[] reqParams = wsInv.getArgs();
               jbInv.setArguments(reqParams);
               Object resObj = getNext().invoke(jbInv);

               // Setting the message to null should trigger binding of the response message
               msgContext.setMessage(null);
               wsInv.setReturnValue(resObj);
            }

            // call the response handlers
            handlersPass = callback.callResponseHandlerChain(wsInv, HandlerType.POST);
            handlersPass = handlersPass && callback.callResponseHandlerChain(wsInv, HandlerType.ENDPOINT);

            // update the return value after response handler processing
            Object resObj = wsInv.getReturnValue();

            return resObj;
         }
         catch (Exception ex)
         {
            try
            {
               // call the fault handlers
               boolean handlersPass = callback.callFaultHandlerChain(wsInv, HandlerType.POST, ex);
               handlersPass = handlersPass && callback.callFaultHandlerChain(wsInv, HandlerType.ENDPOINT, ex);
            }
            catch (Exception subEx)
            {
               log.warn("Cannot process handlerChain.handleFault, ignoring: ", subEx);
            }
View Full Code Here

      Method method = inv.getJavaMethod();
      Object[] args = inv.getArgs();
      org.jboss.invocation.Invocation jbInv = new org.jboss.invocation.Invocation(null, method, args, null, principal, credential);

      HandlerCallback callback = inv.getInvocationContext().getAttachment(HandlerCallback.class);
      if (callback == null)
         throw new IllegalStateException("Cannot obtain HandlerCallback");

      jbInv.setValue(InvocationKey.SOAP_MESSAGE_CONTEXT, msgContext);
      jbInv.setValue(InvocationKey.SOAP_MESSAGE, ((SOAPMessageContext)msgContext).getMessage());
View Full Code Here

        @Override
        public Object processInvocation(final InterceptorContext context) throws Exception {
            final SOAPMessageContext msgContext = (SOAPMessageContext) context.getPrivateData(MessageContext.class);
            final Invocation wsInvocation = (Invocation) context.getPrivateData(Invocation.class);
            final HandlerCallback callback = (HandlerCallback) context.getPrivateData(HandlerCallback.class);
            if (msgContext == null || callback == null || wsInvocation == null) {
                // not for us
                return context.proceed();
            }

            // Handlers need to be Tx. Therefore we must invoke the handler chain after the TransactionInterceptor.
            try {
                // call the request handlers
                boolean handlersPass = callback.callRequestHandlerChain(wsInvocation, HandlerType.ENDPOINT);
                handlersPass = handlersPass && callback.callRequestHandlerChain(wsInvocation, HandlerType.POST);

                // Call the next interceptor in the chain
                if (handlersPass) {
                    // The SOAPContentElements stored in the EndpointInvocation might have changed after
                    // handler processing. Get the updated request payload. This should be a noop if request
                    // handlers did not modify the incomming SOAP message.
                    final Object[] reqParams = wsInvocation.getArgs();
                    context.setParameters(reqParams);
                    final Object resObj = context.proceed();

                    // Setting the message to null should trigger binding of the response message
                    msgContext.setMessage(null);
                    wsInvocation.setReturnValue(resObj);
                }

                // call the response handlers
                handlersPass = callback.callResponseHandlerChain(wsInvocation, HandlerType.POST);
                handlersPass = handlersPass && callback.callResponseHandlerChain(wsInvocation, HandlerType.ENDPOINT);

                // update the return value after response handler processing
                return wsInvocation.getReturnValue();
            }
            catch (final Exception ex) {
                try {
                    // call the fault handlers
                    boolean handlersPass = callback.callFaultHandlerChain(wsInvocation, HandlerType.POST, ex);
                    handlersPass = handlersPass && callback.callFaultHandlerChain(wsInvocation, HandlerType.ENDPOINT, ex);
                }
                catch (Exception ignore) {}
                throw ex;
            }
        }
View Full Code Here

        @Override
        public Object processInvocation(final InterceptorContext context) throws Exception {
            final SOAPMessageContext msgContext = (SOAPMessageContext) context.getPrivateData(MessageContext.class);
            final Invocation wsInvocation = (Invocation) context.getPrivateData(Invocation.class);
            final HandlerCallback callback = (HandlerCallback) context.getPrivateData(HandlerCallback.class);
            if (msgContext == null || callback == null || wsInvocation == null) {
                // not for us
                return context.proceed();
            }

            // Handlers need to be Tx. Therefore we must invoke the handler chain after the TransactionInterceptor.
            try {
                // call the request handlers
                boolean handlersPass = callback.callRequestHandlerChain(wsInvocation, HandlerType.ENDPOINT);
                handlersPass = handlersPass && callback.callRequestHandlerChain(wsInvocation, HandlerType.POST);

                // Call the next interceptor in the chain
                if (handlersPass) {
                    // The SOAPContentElements stored in the EndpointInvocation might have changed after
                    // handler processing. Get the updated request payload. This should be a noop if request
                    // handlers did not modify the incomming SOAP message.
                    final Object[] reqParams = wsInvocation.getArgs();
                    context.setParameters(reqParams);
                    final Object resObj = context.proceed();

                    // Setting the message to null should trigger binding of the response message
                    msgContext.setMessage(null);
                    wsInvocation.setReturnValue(resObj);
                }

                // call the response handlers
                handlersPass = callback.callResponseHandlerChain(wsInvocation, HandlerType.POST);
                handlersPass = handlersPass && callback.callResponseHandlerChain(wsInvocation, HandlerType.ENDPOINT);

                // update the return value after response handler processing
                return wsInvocation.getReturnValue();
            }
            catch (final Exception ex) {
                try {
                    // call the fault handlers
                    boolean handlersPass = callback.callFaultHandlerChain(wsInvocation, HandlerType.POST, ex);
                    handlersPass = handlersPass && callback.callFaultHandlerChain(wsInvocation, HandlerType.ENDPOINT, ex);
                }
                catch (Exception ignore) {}
                throw ex;
            }
        }
View Full Code Here

TOP

Related Classes of org.jboss.wsf.spi.invocation.HandlerCallback

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.