Package org.apache.axis2

Examples of org.apache.axis2.AxisFault$FaultReason


    EndpointReference to = createSequenceMsg.getTo();
    if (to == null) {
      String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.toEPRNotValid, null);
      log.debug(message);
      throw new AxisFault(message);
    }

    EndpointReference replyTo = createSequenceMsg.getReplyTo();

    CreateSequence createSequence = (CreateSequence) createSequenceMsg
        .getMessagePart(Sandesha2Constants.MessageParts.CREATE_SEQ);
    if (createSequence == null) {
      String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.createSeqEntryNotFound);
      log.debug(message);
      throw new AxisFault(message);
    }

    EndpointReference acksTo = createSequence.getAcksTo().getEPR();

    if (acksTo == null) {
View Full Code Here


      configurationContext = storageManager.getContext();
    else
      configurationContext = messageContext.getConfigurationContext();     

    // Notify the clients of a timeout
    AxisFault fault = new AxisFault(
        SandeshaMessageHelper.getMessage(SandeshaMessageKeys.cannotSendMsgAsSequenceTimedout, internalSequenceID));
    // Notify any waiting clients that the sequence has timeed out.
    FaultManager.notifyClientsOfFault(internalSequenceID, storageManager, configurationContext, fault);
   
    // Already an active transaction, so don't want a new one
View Full Code Here

                proxyProperties.setUserName("");
                proxyProperties.setPassWord("");
                proxyProperties.setDomain("");
                options.setProperty(HTTPConstants.PROXY, proxyProperties);
            } catch (MalformedURLException e) {
                throw new AxisFault("Error creating proxy URL", e);
            }
        }

        client.setOptions(options);
        String testString = "";
View Full Code Here

                    proxyProperties.setUserName("");
                    proxyProperties.setPassWord("");
                    proxyProperties.setDomain("");
                    options.setProperty(HTTPConstants.PROXY, proxyProperties);
                } catch (MalformedURLException e) {
                    throw new AxisFault("Error creating proxy URL", e);
                }
            }
            client.setOptions(options);

            int i = 0;
View Full Code Here

     * @param axisRequestMsgCtx
     * @throws org.apache.axis2.AxisFault
     */
    public void receive(org.apache.axis2.context.MessageContext axisRequestMsgCtx)
            throws AxisFault {
        AxisFault faultToReturn = null;

        if (log.isDebugEnabled()) {
            log.debug("new request received");
        }

        //Get the name of the service impl that was stored as a parameter
        // inside of the services.xml.
        AxisService service = axisRequestMsgCtx.getAxisService();

        // we need to set the deployment class loader as the TCCL. This is because, in JAX-WS
        // services, there can be situations where we have to load classes from the deployment
        // artifact (JAX-WS jar file) in the message flow. Ex: Handler classes in the service
        // artifact. Adding this as a fix for AXIS2-4930.
        setContextClassLoader(service.getClassLoader());

        org.apache.axis2.description.Parameter svcClassParam =
                service.getParameter(PARAM_SERVICE_CLASS);

        if (svcClassParam == null) {
            throw new RuntimeException(
                    Messages.getMessage("JAXWSMessageReceiverNoServiceClass"));
        }

        Parameter endpointDescParam =
                service.getParameter(EndpointDescription.AXIS_SERVICE_PARAMETER);
        if (endpointDescParam == null) {
            throw new RuntimeException(Messages.getMessage("JAXWSMessageReceiverNoServiceClass"));
        }
        AxisOperation operation = axisRequestMsgCtx.getAxisOperation();
        String mep = operation.getMessageExchangePattern();
        if (log.isDebugEnabled()) {
            log.debug("MEP: " + mep);
        }

        try {

            //This assumes that we are on the ultimate execution thread
            ThreadContextMigratorUtil.performMigrationToThread(
                    Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID, axisRequestMsgCtx);

            //We'll need an instance of the EndpointController to actually
            //drive the invocation.
            //TODO: More work needed to determine the lifecycle of this thing
            EndpointController endpointCtlr = new EndpointController();

            MessageContext requestMsgCtx = new MessageContext(axisRequestMsgCtx);
            requestMsgCtx.setServer(true);
            requestMsgCtx.setMEPContext(new MEPContext(requestMsgCtx));
            ClassLoader loader = getCachedClassLoader(axisRequestMsgCtx);
            if (loader != null) {
                requestMsgCtx.setProperty(org.apache.axis2.jaxws.spi.Constants.CACHE_CLASSLOADER,
                        loader);
            }
            // The adapters need to be installed on the new request Message Context
            AttachmentsAdapter.install(requestMsgCtx);
            TransportHeadersAdapter.install(requestMsgCtx);
            SOAPHeadersAdapter.install(requestMsgCtx);
           
            Binding binding = (Binding)axisRequestMsgCtx.getProperty(PARAM_BINDING);
            EndpointInvocationContext eic = InvocationContextFactory.createEndpointInvocationContext(binding);
            addInvocationListenerFactories(eic);
            eic.setRequestMessageContext(requestMsgCtx);

            // WARNING: This should be left disabled for now.  This locks the server side
            // into a single threaded invocation.
            eic.getRequestMessageContext().setProperty(ServerConstants.SERVER_DISABLE_THREAD_SWITCH, true);

            if (isMepInOnly(mep)) {
                if (log.isDebugEnabled()) {
                    log.debug("Detected a one way invocation.");
                }
                eic.setIsOneWay(true);
                endpointCtlr.invokeOneWay(eic);
            } else if (JavaUtils.isTrueExplicitly(axisRequestMsgCtx.getProperty(
                AddressingConstants.IS_ADDR_INFO_ALREADY_PROCESSED))
                && (axisRequestMsgCtx.getReplyTo() != null
                && !axisRequestMsgCtx.getReplyTo().hasAnonymousAddress())) {
               
                if (log.isDebugEnabled()) {
                    log.debug("Detected an async invocation.");
                }
               
                EndpointCallback ecb = new EndpointCallback();
                eic.setCallback(ecb);
               
                endpointCtlr.invokeAsync(eic);
            } else {
                if (log.isDebugEnabled()) {
                    log.debug("Detected a sync invocation.");
                }
                eic = endpointCtlr.invoke(eic);

                // If this is a two-way exchange, there should already be a
                // JAX-WS MessageContext for the response.  We need to pull
                // the Message data out of there and set it on the Axis2
                // MessageContext.
                MessageContext responseMsgCtx = eic.getResponseMessageContext();
                // Note that responseMsgCtx may be null if the Provider returned null
                // and no wsdl was specified.
                // In JAX-WS 2.2 for Providers that return null we should send back
                // an empty payload, not a SOAPEnvelope.
                if (responseMsgCtx == null &&
                        MessageContextUtils.getJaxwsProviderInterpretNullOneway(requestMsgCtx)) {
                    if (log.isDebugEnabled()) {
                        log.debug("Detected a null return from a Provider, sending back an ack instead of a response.");
                    }
                    sendAckBack(axisRequestMsgCtx);                  
                } else {
                    org.apache.axis2.context.MessageContext axisResponseMsgCtx =
                        responseMsgCtx.getAxisMessageContext();
                    if (loader != null) {
                        responseMsgCtx.setProperty(org.apache.axis2.jaxws.spi.Constants.CACHE_CLASSLOADER,
                                loader);
                    }
                    MessageUtils.putMessageOnMessageContext(responseMsgCtx.getMessage(),
                            axisResponseMsgCtx);

                    OperationContext opCtx = axisResponseMsgCtx.getOperationContext();
                    opCtx.addMessageContext(axisResponseMsgCtx);

                    // If this is a fault message, we want to throw it as an
                    // exception so that the transport can do the appropriate things
                    if (responseMsgCtx.getMessage().isFault()) {

                        //Rather than create a new AxisFault, we should use the AxisFault that was
                        //created at the causedBy
                        if (responseMsgCtx.getCausedByException() != null) {
                            faultToReturn = responseMsgCtx.getCausedByException();
                            if (log.isDebugEnabled()) {
                                log.debug("Setting causedByException from response MessageContext");
                            }
                        } else if (requestMsgCtx.getCausedByException() != null) {
                            faultToReturn = requestMsgCtx.getCausedByException();
                            if (log.isDebugEnabled()) {
                                log.debug("Setting causedByException from request MessageContext..which indicates an exception occured in the inbound handler processing");
                            }
                        } else {
                            faultToReturn = new AxisFault("An error was detected during JAXWS processing",
                                    axisResponseMsgCtx);
                            if (log.isDebugEnabled()) {
                                log.debug("No causedByException detected");
                            }
                        }
View Full Code Here

            if (headerBlock.isProcessed() || !headerBlock.getMustUnderstand()) {
                continue;
            }

            QName faultQName = headerBlock.getVersion().getMustUnderstandFaultCode();
            throw new AxisFault(Messages.getMessage("mustunderstandfailed",
                                                    headerBlock.getNamespace().getNamespaceURI(),
                                                    headerBlock.getLocalName()), faultQName);
        }
        return checksPass;
    }
View Full Code Here

    public void onError(Exception e) {
        // If a SOAPFault was returned by the AxisEngine, the AxisFault
        // that is returned should have a MessageContext with it.  Use
        // this to unmarshall the fault included there.
        if (e.getClass().isAssignableFrom(AxisFault.class)) {
            AxisFault fault = (AxisFault)e;
            MessageContext faultMessageContext = null;
            try {
                faultMessageContext =
                        AsyncUtils.createJAXWSMessageContext(fault.getFaultMessageContext());
                faultMessageContext.setInvocationContext(invocationCtx);
                // make sure request and response contexts share a single parent
                faultMessageContext.setMEPContext(invocationCtx.getRequestMessageContext().getMEPContext());
            } catch (WebServiceException wse) {
                response.onError(wse, null);
View Full Code Here

    public void onError(Exception e) {
        // If a SOAPFault was returned by the AxisEngine, the AxisFault
        // that is returned should have a MessageContext with it.  Use
        // this to unmarshall the fault included there.
        if (e.getClass().isAssignableFrom(AxisFault.class)) {
            AxisFault fault = (AxisFault)e;
            MessageContext faultMessageContext = null;
            try {
                faultMessageContext  = AsyncUtils.createJAXWSMessageContext(fault.getFaultMessageContext());
                faultMessageContext.setInvocationContext(invocationCtx);
                // make sure request and response contexts share a single parent
                faultMessageContext.setMEPContext(invocationCtx.getRequestMessageContext().getMEPContext());
            } catch (WebServiceException wse) {
                cft.setError(wse);
View Full Code Here

        org.apache.axis2.context.MessageContext axisRequestMsgCtx = request.getAxisMessageContext();
        org.apache.axis2.context.MessageContext axisResponseMsgCtx = null;

        MessageContext response = null;

        AxisFault faultexception =
                null// don't let the keyword "fault" confuse you.  This is an exception class.
        try {
            execute(opClient, true, axisRequestMsgCtx);
        } catch (AxisFault af) {
            // If an AxisFault was thrown, we need to cleanup the original OperationContext.
View Full Code Here

            String[] headerNames = new String[qNames.length];
            for(int i=0; i<qNames.length; i++){
                headerNames[i] ="{" + qNames[i].getNamespaceURI()+ "}" + qNames[i].getLocalPart();
            }
            QName faultQName = envelope.getVersion().getMustUnderstandFaultCode();
            throw new AxisFault(Messages.getMessage("mustunderstandfailed2", headerNames), faultQName);
        }

        checkUnprocessed(envelope, unprocessed, understood, msgContext);
        //resetting the FAULTY_HEADER_QNAME to null.
        msgContext.setProperty(Constants.UNPROCESSED_HEADER_QNAMES, null);
View Full Code Here

TOP

Related Classes of org.apache.axis2.AxisFault$FaultReason

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.