Package org.apache.sandesha2

Examples of org.apache.sandesha2.SandeshaException


  public void checkProofOfPossession(SecurityToken token, OMElement messagePart,
      MessageContext message) throws SandeshaException {
    log.debug("Enter: UnitTestSecurityManager::checkProofOfPossession");
    if(token == null) {
      throw new SandeshaException("Security manager was passed a null token");
    }
   
    // Look for the header that we should have introduced in the 'apply' method
    String key = ((UnitTestSecurityToken)token).getURI();
    boolean foundToken = false;
    SOAPEnvelope env = message.getEnvelope();
    SOAPHeader headers = env.getHeader();
    if(headers != null) {
      Iterator tokens = headers.getChildrenWithName(unitTestHeader);
      while(tokens.hasNext()) {
        OMElement myHeader = (OMElement) tokens.next();
        String text = myHeader.getText();
        if(key.equals(text)) {
          foundToken = true;
          break;
        }
      }
    }
    if(!foundToken) {
      SandeshaException e = new SandeshaException("Message was not secured with the correct token(s)");
      e.printStackTrace(System.err);
      throw e;
    }

    log.debug("Exit: UnitTestSecurityManager::checkProofOfPossession");
  }
View Full Code Here


  }

  public void applySecurityToken(SecurityToken token, MessageContext outboundMessage) throws SandeshaException {
    log.debug("Enter: UnitTestSecurityManager::applySecurityToken");
    if(token == null) {
      throw new SandeshaException("Security manager was passed a null token");
    }
   
    // Add the header that pretends to secure the message
    String key = ((UnitTestSecurityToken)token).getURI();
    SOAPEnvelope env = outboundMessage.getEnvelope();
View Full Code Here

    if (rmsBean == null)
    {
      if (log.isDebugEnabled())
        log.debug("Exit: WSRMParentProcessor::setupOutMessage Sequence doesn't exist");
     
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.couldNotSendTerminateSeqNotFound, internalSequenceID));     
    }
   
    if (rmsBean.getSequenceID() != null)
    {
      sequenceExists = true;   
      outSequenceID = rmsBean.getSequenceID();
    }
    else
      outSequenceID = Sandesha2Constants.TEMP_SEQUENCE_ID;     

    rmVersion = rmsBean.getRMVersion();
    if (rmVersion == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.cannotDecideRMVersion));

    if (log.isDebugEnabled())
      log.debug("Exit: WSRMParentProcessor::setupOutMessage");
  }
View Full Code Here

      if (makeConnection.getIdentifier()!=null) {
        sequenceID = makeConnection.getIdentifier().getIdentifier();
      } else if (makeConnection.getAddress()!=null){
        //TODO get sequenceId based on the anonymous address.
      } else {
        throw new SandeshaException (
            "Invalid MakeConnection message. Either Address or Identifier must be present");
      }
    } else
      rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.UNKNOWN);
   
View Full Code Here

    try {
      AxisEngine.send(closeSequenceResponseMsg);
    } catch (AxisFault e) {
      String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.couldNotSendCloseResponse,
          sequenceId, e.toString());
      throw new SandeshaException(message, e);
    }

    if (log.isDebugEnabled())
      log.debug("Exit: CloseSequenceProcessor::processInMessage " + Boolean.FALSE);
    return false;
View Full Code Here

    // Setting the ack depending on AcksTo.
    EndpointReference acksTo = new EndpointReference(rmdBean.getAcksToEPR());
    String acksToStr = acksTo.getAddress();

    if (acksToStr == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.acksToStrNotSet));

    //Getting the operation for ack messages.
    AxisOperation ackOperation = SpecSpecificConstants.getWSRMOperation(
        Sandesha2Constants.MessageTypes.ACK,
        rmdBean.getRMVersion(),
        msgContext.getAxisService());
   
    MessageContext ackMsgCtx = SandeshaUtil.createNewRelatedMessageContext(rmMsgCtx, ackOperation);
   
    //setting up the RMMsgContext
    RMMsgContext ackRMMsgCtx = MsgInitializer.initializeMessage(ackMsgCtx);
    ackRMMsgCtx.setRMNamespaceValue(rmMsgCtx.getRMNamespaceValue());
       
    ackMsgCtx.setTo(acksTo);
       
    ackRMMsgCtx.setRMNamespaceValue(rmMsgCtx.getRMNamespaceValue());
   
    if (ackMsgCtx.getMessageID()==null)
      ackMsgCtx.setMessageID(SandeshaUtil.getUUID());
   
    //adding the SOAP Envelope
    SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil.getSOAPVersion(msgContext.getEnvelope()));
    SOAPEnvelope envelope = factory.getDefaultEnvelope();
    try {
      ackMsgCtx.setEnvelope(envelope);
    } catch (AxisFault e3) {
      throw new SandeshaException(e3.getMessage());
    }

    ackMsgCtx.setReplyTo(msgContext.getTo());
    RMMsgCreator.addAckMessage(ackRMMsgCtx, sequenceId, rmdBean);
   
    //this is not a client generated message. So set serverSide to true.
    ackMsgCtx.setServerSide(true);

    if (acksTo.hasAnonymousAddress()) {
      //If acksTo is anonymous we will be sending the ack here it self. Transport will use what ever mechanism to send the
      //message. (for e.g. HTTP will use the back channel)

      // setting "response written" since acksto is anonymous
     
      //adding an OperationContext if one is not available. (for e.g. If we are in the SandeshaGlobalInHandler)
      if (rmMsgCtx.getMessageContext().getOperationContext() == null) {
        // operation context will be null when doing in a GLOBAL
        // handler.
       
        ServiceContext serviceCtx = msgContext.getServiceContext();
        OperationContext opCtx =  OperationContextFactory.createOperationContext(ackOperation.getAxisSpecificMEPConstant(), ackOperation, serviceCtx);

        rmMsgCtx.getMessageContext().setOperationContext(opCtx);
      }
     
      try {
        AxisEngine.send(ackMsgCtx);
        TransportUtils.setResponseWritten(ackMsgCtx, true);
      } catch (AxisFault e1) {
        throw new SandeshaException(e1.getMessage());
      }

    } else {
      //If AcksTo is non-anonymous we will be adding a senderBean entry here. The sender is responsible
      //for sending it out.
View Full Code Here

    while (iterator.hasNext()) {
      ackRequested = (AckRequested) iterator.next();
    }
   
    if (iterator.hasNext()) {
      throw new SandeshaException (SandeshaMessageHelper.getMessage(SandeshaMessageKeys.ackRequestMultipleParts));
    }
   
    if (ackRequested==null) {
      throw new SandeshaException (SandeshaMessageHelper.getMessage(SandeshaMessageKeys.noAckRequestPartFound));
    }
   
    ackRequestRMMsg.setWSAAction(SpecSpecificConstants.getAckRequestAction (getRMVersion()));
    ackRequestRMMsg.setSOAPAction(SpecSpecificConstants.getAckRequestSOAPAction (getRMVersion()));
View Full Code Here

    TransportOutDescription transportOut = pollMessage.getMessageContext().getTransportOut();
    if (transportOut==null) {
      String message = SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.cantSendMakeConnectionNoTransportOut);
      if(log.isDebugEnabled()) log.debug(message);
      throw new SandeshaException (message);
    }
     
    String messageStorageKey = matchingMessage.getMessageContextRefKey();
    MessageContext returnMessage = storageManager.retrieveMessageContext(messageStorageKey,pollMessage.getConfigurationContext());
    if (returnMessage==null) {
View Full Code Here

    MessageContext referenceMsg = referenceRMMessage.getMessageContext();

    EndpointReference acksTo = new EndpointReference(rmdBean.getAcksToEPR());

    if (acksTo.getAddress() == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.acksToStrNotSet));

    AxisOperation ackOperation = SpecSpecificConstants.getWSRMOperation(
        Sandesha2Constants.MessageTypes.ACK,
        rmdBean.getRMVersion(),
        referenceMsg.getAxisService());
View Full Code Here

    httpServer = new SimpleHTTPServer(configContext, serverPort);
    httpServer.start();
    try {
      Thread.sleep(300);
    } catch (InterruptedException e) {
      throw new SandeshaException("sleep interupted");
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.sandesha2.SandeshaException

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.