Package org.apache.sandesha2.scenarios

Examples of org.apache.sandesha2.scenarios.AnonymousAckEchoTest$TestCallback


    MessageContext messageContext = new MessageContext();
    messageContext.setConfigurationContext(serverConfigContext);
    messageContext.setAxisService(serverConfigContext.getAxisConfiguration().getService("RMSampleService"));   
    messageContext.setEnvelope(dummyEnvelope);
   
    RMMsgContext applicationRMMsg = new RMMsgContext(messageContext);
   
    // Create an RMSBean so the create sequence message can be created
    RMSBean rmsBean = new RMSBean();
    rmsBean.setRMVersion(Sandesha2Constants.SPEC_VERSIONS.v1_1);
    rmsBean.setToEPR(to);
    rmsBean.setAcksToEPR(AddressingConstants.Final.WSA_NONE_URI);
       
    // Create a Create Sequence message
    // generating a new create sequeuce message.
    RMMsgContext createSeqRMMessage = RMMsgCreator.createCreateSeqMsg(rmsBean, applicationRMMsg);
    messageContext = createSeqRMMessage.getMessageContext();
    messageContext.setWSAAction(SpecSpecificConstants.getCreateSequenceAction(Sandesha2Constants.SPEC_VERSIONS.v1_1));

    CreateSequence createSeqResPart = (CreateSequence) createSeqRMMessage
    .getMessagePart(Sandesha2Constants.MessageParts.CREATE_SEQ);

    createSeqResPart.setAcksTo(
        new AcksTo(new EndpointReference(AddressingConstants.Final.WSA_NONE_URI),
                   SpecSpecificConstants.getRMNamespaceValue(rmsBean.getRMVersion()),
                   AddressingConstants.Final.WSA_NAMESPACE));
   
    // Update the SOAP Envelope of the message
    createSeqRMMessage.addSOAPEnvelope();

    SOAPEnvelope envelope = createSeqRMMessage.getMessageContext().getEnvelope();
   
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
   
    envelope.serialize(outputStream);
   
View Full Code Here


    MessageContext messageContext = new MessageContext();
    messageContext.setConfigurationContext(serverConfigContext);
    messageContext.setAxisService(serverConfigContext.getAxisConfiguration().getService("RMSampleService"));   
    messageContext.setEnvelope(dummyEnvelope);
   
    RMMsgContext applicationRMMsg = new RMMsgContext(messageContext);
   
    // Generate the Sequence field.
    // -------------------------------
    String rmNamespaceValue = SpecSpecificConstants.getRMNamespaceValue(Sandesha2Constants.SPEC_VERSIONS.v1_1);

    Sequence sequence = new Sequence(rmNamespaceValue);
    MessageNumber msgNumber = new MessageNumber(rmNamespaceValue);
    msgNumber.setMessageNumber(1);
    sequence.setMessageNumber(msgNumber);
    Identifier id1 = new Identifier(rmNamespaceValue);
    id1.setIndentifer(uuid);
    sequence.setIdentifier(id1);
    applicationRMMsg.setMessagePart(Sandesha2Constants.MessageParts.SEQUENCE, sequence);
    applicationRMMsg.addSOAPEnvelope();

    // --------------------------------------------
    // Finished generating Sequence part
   
    // Create an RMSBean so the create sequence message can be created
    messageContext.setWSAAction(pingAction);

    // Set the AxisOperation to be InOut
    AxisOperation operation = messageContext.getAxisService().getOperation(Sandesha2Constants.RM_IN_OUT_OPERATION);
    operation.setMessageReceiver(new RMMessageReceiver());
    messageContext.setAxisOperation(operation);

    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
   
    // Serialize the application message
    applicationRMMsg.getMessageContext().getEnvelope().serialize(outputStream);
   
    return outputStream.toByteArray();
  }
View Full Code Here

    }

    rmdBean.setClosed(true);
    storageManager.getRMDBeanMgr().update(rmdBean);

    RMMsgContext ackRMMsgCtx = AcknowledgementManager.generateAckMessage(rmMsgCtx, rmdBean, sequenceId, storageManager, true);
    // adding the ack part(s) to the envelope.
    Iterator sequenceAckIter = ackRMMsgCtx
        .getMessageParts(Sandesha2Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);

    RMMsgContext closeSeqResponseRMMsg = RMMsgCreator.createCloseSeqResponseMsg(rmMsgCtx, rmdBean);
    MessageContext closeSequenceResponseMsg = closeSeqResponseRMMsg.getMessageContext();

    while (sequenceAckIter.hasNext()) {
      SequenceAcknowledgement sequenceAcknowledgement = (SequenceAcknowledgement) sequenceAckIter.next();
      closeSeqResponseRMMsg.setMessagePart(Sandesha2Constants.MessageParts.SEQ_ACKNOWLEDGEMENT,
          sequenceAcknowledgement);
    }
   
    closeSeqResponseRMMsg.setFlow(MessageContext.OUT_FLOW);
    closeSeqResponseRMMsg.setProperty(Sandesha2Constants.APPLICATION_PROCESSING_DONE, "true");

    closeSequenceResponseMsg.setResponseWritten(true);

    closeSeqResponseRMMsg.addSOAPEnvelope();
   
    //
    // Now that we have generated the message we can commit the transaction
    //
    if(transaction != null && transaction.isActive()) {
View Full Code Here

   *
   * @return
   * @throws SandeshaException
   */
  public static RMMsgContext initializeMessage(MessageContext ctx) throws AxisFault {
    RMMsgContext rmMsgCtx = new RMMsgContext(ctx);

    populateRMMsgContext(ctx, rmMsgCtx);
    validateMessage(rmMsgCtx);
    return rmMsgCtx;
  }
View Full Code Here

        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
View Full Code Here

  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

TOP

Related Classes of org.apache.sandesha2.scenarios.AnonymousAckEchoTest$TestCallback

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.