Package org.apache.axis2

Examples of org.apache.axis2.AxisFault$FaultReason


    SOAPBody body = envelope.getBody();

    OMElement payload = body.getFirstElement();
    OMElement attachmentElem = payload.getFirstChildWithName(new QName(applicationNamespaceName, Attachment));
    if (attachmentElem == null)
      throw new AxisFault("'Attachment' element is not present as a child of the 'Ping' element");

    OMText binaryElem = (OMText) attachmentElem.getFirstOMChild();

    binaryElem.setOptimize(true);
    DataHandler dataHandler = (DataHandler) binaryElem.getDataHandler();
View Full Code Here


  public void test2WayWithoutMakeConnectionFails() throws Exception  {
    // Run a ping test with sync acks - this should work even though MakeConnection is disabled
    runPing(false, false);
   
    // Run an echo test with sync acks - this should fail as MakeConnection is disabled
    AxisFault fault = null;
    Options clientOptions = new Options();
    clientOptions.setProperty(SandeshaClientConstants.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1);
    try {
      runEcho(clientOptions, false, false, false, false, true);
    } catch (AxisFault e) {
View Full Code Here

        {
          response.flushBuffer();
        }
        catch (IOException e)
        {
          throw new AxisFault("Error sending acknowledgement", e);
        }
       
        signalResponseReady();
      }
View Full Code Here

            return false;
        } else {
            try {
                emailAddress = new InternetAddress(address);
            } catch (AddressException e) {
                throw new AxisFault("Invalid email address specified by '" +
                        MailConstants.TRANSPORT_MAIL_ADDRESS + "' parameter :: " + e.getMessage());
            }

            List<Parameter> params = paramIncl.getParameters();
            Properties props = new Properties();
            for (Parameter p : params) {
                if (p.getName().startsWith("mail.")) {
                    props.setProperty(p.getName(), (String) p.getValue());
                }

                if (MailConstants.MAIL_POP3_USERNAME.equals(p.getName()) ||
                    MailConstants.MAIL_IMAP_USERNAME.equals(p.getName())) {
                    userName = (String) p.getValue();
                }
                if (MailConstants.MAIL_POP3_PASSWORD.equals(p.getName()) ||
                    MailConstants.MAIL_IMAP_PASSWORD.equals(p.getName())) {
                    password = (String) p.getValue();
                }
                if (MailConstants.TRANSPORT_MAIL_PROTOCOL.equals(p.getName())) {
                    protocol = (String) p.getValue();
                }
            }

            session = Session.getInstance(props, null);
            MailUtils.setupLogging(session, log, paramIncl);

            contentType =
                ParamUtils.getOptionalParam(paramIncl, MailConstants.TRANSPORT_MAIL_CONTENT_TYPE);
            try {
                String replyAddress =
                    ParamUtils.getOptionalParam(paramIncl, MailConstants.TRANSPORT_MAIL_REPLY_ADDRESS);
                if (replyAddress != null) {
                    this.replyAddress = new InternetAddress(replyAddress);  
                }
            } catch (AddressException e) {
                throw new AxisFault("Invalid email address specified by '" +
                        MailConstants.TRANSPORT_MAIL_REPLY_ADDRESS + "' parameter :: " +
                        e.getMessage());
            }

            folder =
View Full Code Here

      if (Sandesha2Constants.SPEC_VERSIONS.v1_0.equals(inRMMsgContext.getRMSpecVersion())
          && (faultEPR==null || faultEPR.hasAnonymousAddress())) {
        RequestResponseTransport requestResponseTransport = (RequestResponseTransport) inRMMsgContext.getProperty(RequestResponseTransport.TRANSPORT_CONTROL);
       
        //this will cause the fault to be thrown out of thread waiting on this transport object.
        AxisFault fault = new AxisFault ("Sandesha2 got a fault when doing the invocation", faultContext);
        if (requestResponseTransport!=null)
          requestResponseTransport.signalFaultReady(fault);
        else
          engine.sendFault(faultContext);
       
View Full Code Here

   
    ConfigurationContext context = msgCtx.getConfigurationContext();
    if (context == null) {
      String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.configContextNotSet);
      log.debug(message);
      throw new AxisFault(message);
    }

    String DONE = (String) msgCtx.getProperty(Sandesha2Constants.APPLICATION_PROCESSING_DONE);
    if (null != DONE && Sandesha2Constants.VALUE_TRUE.equals(DONE)) {
      if (log.isDebugEnabled())
        log.debug("Exit: SandeshaInHandler::invoke, Application processing done " + returnValue);
      return returnValue;
    }
   
    // look at the service to see if RM is totally disabled. This allows the user to disable RM using
    // a property on the service, even when Sandesha is engaged.
    if (msgCtx.getAxisService() != null) {
      Parameter unreliableParam = msgCtx.getAxisService().getParameter(SandeshaClientConstants.UNRELIABLE_MESSAGE);
      if (null != unreliableParam && "true".equals(unreliableParam.getValue())) {
        log.debug("Exit: SandeshaInHandler::invoke, Service has disabled RM " + returnValue);
        return returnValue;
      }
    }
    if (log.isDebugEnabled()) log.debug("SandeshaInHandler::invoke Continuing beyond basic checks");

    Transaction transaction = null;

    try {
      StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(context, context.getAxisConfiguration());
      transaction = storageManager.getTransaction();

      AxisService axisService = msgCtx.getAxisService();
      if (axisService == null) {
        String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.axisServiceIsNull);
        log.debug(message);
        throw new AxisFault(message);
      }

      RMMsgContext rmMsgCtx = null;
     
      if (msgCtx.getProperty(Sandesha2Constants.MessageContextProperties.RM_MESSAGE_CONTEXT) != null)
        rmMsgCtx = (RMMsgContext)msgCtx.getProperty(Sandesha2Constants.MessageContextProperties.RM_MESSAGE_CONTEXT);
      else
        rmMsgCtx = MsgInitializer.initializeMessage(msgCtx);

      // validating the message
      MessageValidator.validateIncomingMessage(rmMsgCtx, storageManager);
     
      // commit the current transaction
      if(transaction != null && transaction.isActive()) transaction.commit();
      transaction = storageManager.getTransaction();

      // Process Ack headers in the message
      AcknowledgementProcessor ackProcessor = new AcknowledgementProcessor();
      ackProcessor.processAckHeaders(rmMsgCtx);

      // commit the current transaction
      if(transaction != null && transaction.isActive()) transaction.commit();
      transaction = storageManager.getTransaction();

      // Process Ack Request headers in the message
      AckRequestedProcessor reqProcessor = new AckRequestedProcessor();
      if(reqProcessor.processAckRequestedHeaders(rmMsgCtx)){
        returnValue = InvocationResponse.SUSPEND;
      }
     
      // Process MessagePending headers
      MessagePendingProcessor pendingProcessor = new MessagePendingProcessor();
      pendingProcessor.processMessagePendingHeaders(rmMsgCtx);

      // commit the current transaction
      if(transaction != null && transaction.isActive()) transaction.commit();
      transaction = storageManager.getTransaction();

      // Process the Sequence header, if there is one
      SequenceProcessor seqProcessor = new SequenceProcessor();
      returnValue = seqProcessor.processSequenceHeader(rmMsgCtx, transaction);

      // commit the current transaction
      if(transaction != null && transaction.isActive()) transaction.commit();
      transaction = null;
     
    } catch (Exception e) {
      if (log.isDebugEnabled())
        log.debug("SandeshaInHandler::invoke Exception caught during processInMessage", e);
      // message should not be sent in a exception situation.
      msgCtx.pause();
      returnValue = InvocationResponse.SUSPEND;
     
      // Rethrow the original exception if it is an AxisFault
      if (e instanceof AxisFault)
        throw (AxisFault)e;
     
      String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.inMsgError, e.toString());
      throw new AxisFault(message, e);
    }
    finally {
      if (log.isDebugEnabled()) log.debug("SandeshaInHandler::invoke Doing final processing");
      if (transaction != null && transaction.isActive()) {
        try {
View Full Code Here

        //and that this does not disturb the processing of a carrier message.
        try {
          AxisEngine engine = new AxisEngine(faultMessageContext.getConfigurationContext());
          engine.sendFault(faultMessageContext);
        } catch (Exception e) {
          AxisFault fault = new AxisFault(faultColdValue.getTextAsQName(), data.getReason(), "", "", data.getDetail());
          String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.couldNotSendFaultDueToException, fault.getMessage(), e.getMessage());
          log.error(message);
        }
     
      return;
     
    } else {
      String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.unknownSoapVersion);
      throw new SandeshaException (message);
    }
   
    AxisFault fault = new AxisFault(faultColdValue.getTextAsQName(), data.getReason(), "", "", data.getDetail());
    fault.setFaultAction(SpecSpecificConstants.getAddressingFaultAction(referenceRMMsgContext.getRMSpecVersion()));
   
    //if this is throwable throwing it out, else we will log here.
   
    if (throwable)
      throw fault; 
View Full Code Here

      try {
        transaction = storageManager.getTransaction();

        // constructing the fault
        AxisFault axisFault = getAxisFaultFromFromSOAPFault(faultPart);
        response = manageIncomingFault (axisFault, rmMsgCtx, faultPart);
       
        if(transaction != null && transaction.isActive()) transaction.commit();
        transaction = null;
      } finally {
View Full Code Here

    return response;
  }

 
  private static AxisFault getAxisFaultFromFromSOAPFault(SOAPFault faultPart) {
    AxisFault axisFault = new AxisFault(faultPart.getCode(), faultPart.getReason(), faultPart.getNode(), faultPart
        .getRole(), faultPart.getDetail());

    return axisFault;
  }
View Full Code Here

        // message should not be sent in a exception situation.
        msgCtx.pause();
 
        if (!(e instanceof AxisFault)) {
          String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.inMsgError, e.toString());
          throw new AxisFault(message, e);
        }
       
        throw (AxisFault)e;
      } finally {
        if (transaction != null && transaction.isActive()) {
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.