Package org.apache.axis2.jaxws.core

Examples of org.apache.axis2.jaxws.core.MessageContext


       
        proxy.doSomething("12345");
       
        TestClientInvocationController testController = getInvocationController();
        InvocationContext ic = testController.getInvocationContext();
        MessageContext request = ic.getRequestMessageContext();
       
        String version = (String) request.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
        Boolean disabled = (Boolean) request.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
       
        assertEquals(Submission.WSA_NAMESPACE, version);
        assertTrue(disabled);
       
        org.apache.axis2.context.MessageContext axis2Request =
            request.getAxisMessageContext();
        org.apache.axis2.addressing.EndpointReference epr =
            axis2Request.getTo();
       
        assertNull(epr);
    }
View Full Code Here


    /**
     * This method will drive the invocation of the outbound JAX-WS
     * application handler flow.
     */
    protected void invokeOutboundHandlerFlow(EndpointInvocationContext eic) {
        MessageContext request = eic.getRequestMessageContext();
        MessageContext response = eic.getResponseMessageContext();
        if (response != null) {
            // Invoke the outbound response handlers.
            // We can be sure we need to invoke any handlers because this
            // cannot be a one-way flow
            response.setMEPContext(request.getMEPContext());
            HandlerInvocationContext hiContext = EndpointController.buildHandlerInvocationContext(
                                                                               request,
                                                                               eic.getHandlers(),
                                                                               HandlerChainProcessor.MEP.RESPONSE,
                                                                               false);
View Full Code Here

        catch (Throwable e) {
            faultThrown = true;
            fault = e;
        }

        MessageContext response = null;
        if (operationDesc.isOneWay()) {
            // If the operation is one-way, then we can just return null because
            // we cannot create a MessageContext for one-way responses.
            return null;
        } else if (faultThrown) {
View Full Code Here

        } else {
            m = marshaller.marshalResponse(output, params, operationDesc, p);
        }
       
        // We'll need a MessageContext configured based on the response.
        MessageContext response = MessageContextUtils.createResponseMessageContext(request);
        response.setMessage(m);
       
        // Enable MTOM for the response if necessary.
        // (MTOM is not enabled it this operation has SWA parameters
          
        EndpointDescription epDesc = request.getEndpointDescription();
View Full Code Here

        MethodMarshaller marshaller = getMethodMarshaller(p, request.getOperationDescription(),
                                                          request);
       
        Message m = marshaller.marshalFaultResponse(t, request.getOperationDescription(), p);
       
        MessageContext response = MessageContextUtils.createFaultMessageContext(request);
        response.setMessage(m);

        AxisFault axisFault = new AxisFault("The endpoint returned a fault when invoking the target operation.",
                                            response.getAxisMessageContext(),
                                            t);
       
        response.setCausedByException(axisFault);
       
        setFaultResponseAction(t, request, response);
       
        return response;
    }
View Full Code Here

    public EndpointInvocationContext invoke(EndpointInvocationContext eic) throws AxisFault, WebServiceException {
        if (log.isDebugEnabled()) {
            log.debug("Invocation pattern: synchronous");
        }
       
        MessageContext request = eic.getRequestMessageContext();
        boolean good = true;
        try {
            good = handleRequest(eic);

            if (!good) {
                return eic;
            }
            MessageContext response = null;
            EndpointDispatcher dispatcher = eic.getDispatcher();
            if (request != null && dispatcher != null) {
                response = dispatcher.invoke(request);   
                eic.setResponseMessageContext(response);
            }
View Full Code Here

    public void invokeAsync(EndpointInvocationContext eic) {
        if (log.isDebugEnabled()) {
            log.debug("Invocation pattern: asynchronous");
        }
       
        MessageContext request = eic.getRequestMessageContext();
        try {
            boolean good = handleRequest(eic);

            if (!good) {
                return;
            }
            EndpointDispatcher dispatcher = eic.getDispatcher();
            if (request != null && dispatcher != null) {
                dispatcher.invokeAsync(request, eic.getCallback());   
            }
            else {
                throw ExceptionFactory.makeWebServiceException(Messages.getMessage("invokeErr"));
            }
        } catch (Exception e) {
            Throwable toBeThrown = InvocationHelper.determineMappedException(e, eic);
            if(toBeThrown == null) {
                toBeThrown = e;
            }
            throw ExceptionFactory.makeWebServiceException(toBeThrown);
        } finally {
            // FIXME (NLG): Probably need to revisit this location.  Should it be moved down?
            // Passed pivot point
            request.getMessage().setPostPivot();
        }
       
        return;
    }
View Full Code Here

        if (log.isDebugEnabled()) {
            log.debug("Invocation pattern: one-way");
        }
   

        MessageContext request = eic.getRequestMessageContext();
        try {
            boolean good = handleRequest(eic);

            if (!good) {
                return;
            }
            EndpointDispatcher dispatcher = eic.getDispatcher();
            if (request != null && dispatcher != null) {
                dispatcher.invokeOneWay(request);   
            }
            else {
                throw ExceptionFactory.makeWebServiceException(Messages.getMessage("invokeErr"));
            }
        } catch (Exception e) {
            Throwable toBeThrown = InvocationHelper.determineMappedException(e, eic);
            if(toBeThrown == null) {
                toBeThrown = e;
            }
            throw ExceptionFactory.makeWebServiceException(toBeThrown);
        } finally {
            // Passed pivot point
            request.getMessage().setPostPivot();
        }
       
        return;
    }
View Full Code Here

        return;
    }
   
    protected boolean handleRequest(EndpointInvocationContext eic) throws AxisFault, WebServiceException {
       
        MessageContext responseMsgContext = null;

        try {
            requestReceived(eic);
           
            MessageContext request = eic.getRequestMessageContext();
           
            Class serviceEndpoint = getServiceImplementation(request);
            EndpointDescription endpointDesc = getEndpointDescription(request);
            request.setEndpointDescription(endpointDesc);
           
            // Need to make sure the protocol (envelope ns)  of the request matches the binding
            // expected by the service description
            if (!Utils.bindingTypesMatch(request, endpointDesc.getServiceDescription())) {
                Protocol protocol = request.getMessage().getProtocol();
                MessageContext faultContext = Utils.createVersionMismatchMessage(request, protocol);
                eic.setResponseMessageContext(faultContext);
                return false;
            }
           
            //  TODO: review: make sure the handlers are set on the InvocationContext
View Full Code Here

            throw ExceptionFactory.makeWebServiceException(e);
        }
    }
   
    protected boolean handleResponse(EndpointInvocationContext eic) {
        MessageContext request = eic.getRequestMessageContext();
        MessageContext response = eic.getResponseMessageContext();
       
        try {
            if (response != null) {
               // Invoke the outbound response handlers.
               // If the message is one way, we should not invoke the response handlers.  There is no response
               // MessageContext since a one way invocation is considered to have a "void" return.
              
               if (!isOneWay(request.getAxisMessageContext())) {
                    response.setMEPContext(request.getMEPContext());
                   
                    HandlerInvocationContext hiContext = buildHandlerInvocationContext(request, eic.getHandlers(),
                                                                                       HandlerChainProcessor.MEP.RESPONSE,
                                                                                       false);
                    HandlerInvokerFactory hiFactory = (HandlerInvokerFactory)
View Full Code Here

TOP

Related Classes of org.apache.axis2.jaxws.core.MessageContext

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.