Package org.apache.axis2.context

Examples of org.apache.axis2.context.OperationContext


                // Create a new Transaction
                transaction = storageManager.getTransaction();
                RMSBean bean = SandeshaUtil.getRMSBeanFromInternalSequenceId(storageManager, internalSequenceId);
                TerminateManager.terminateSendingSide(bean, storageManager);

                OperationContext opCtx =
                        configurationContext.getOperationContext(bean.getApplicationMessageMessageId());
                if (opCtx != null) {
                    AxisOperation applicationAxisOperation = opCtx.getAxisOperation();
                    if (applicationAxisOperation != null) {
                        MessageReceiver msgReceiver = applicationAxisOperation.getMessageReceiver();
                        if ((msgReceiver != null) && (msgReceiver instanceof CallbackReceiver)) {
                            Object callback = ((CallbackReceiver) msgReceiver)
                                    .lookupCallback(bean.getApplicationMessageMessageId());
View Full Code Here


      }
       
      //we need the incoming thread to wait when suspending.
      //Hence adding the boolean property.
      //Should be done only to the server side
      OperationContext opCtx = msgCtx.getOperationContext();
      if(msgCtx.isServerSide() && opCtx != null && returnValue == InvocationResponse.SUSPEND) {
        if(log.isDebugEnabled()) log.debug("Setting HOLD_RESPONSE property");
        opCtx.setProperty(RequestResponseTransport.HOLD_RESPONSE, Boolean.TRUE);
      }

      if (transaction != null && transaction.isActive()) transaction.commit();
      transaction = null;
View Full Code Here

        // it's still there waiting.
        MessageContext msgCtx = manager.retrieveMessageContext(bean.getMessageContextRefKey(), context);

        RequestResponseTransport t = null;
        MessageContext inMsg = null;
        OperationContext op = msgCtx.getOperationContext();
        if (op != null)
          inMsg = op.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
        if (inMsg != null)
          t = (RequestResponseTransport) inMsg.getProperty(RequestResponseTransport.TRANSPORT_CONTROL);
 
        if((t != null && !RequestResponseTransportStatus.WAITING.equals(t.getStatus()))) {
          if(log.isWarnEnabled()) {
View Full Code Here

            ByteArrayInputStream stream = new ByteArrayInputStream(entry.data);
            ObjectInputStream is = new ObjectInputStream(stream);
            messageContext = (MessageContext) is.readObject();
            messageContext.activate(entry.context);
 
            OperationContext opCtx = messageContext.getOperationContext();
            if(opCtx != null) {
              MessageContext inMsgCtx = opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
              if(inMsgCtx != null) {
                inMsgCtx.setProperty(RequestResponseTransport.TRANSPORT_CONTROL, entry.inTransportControl);
                inMsgCtx.setProperty(MessageContext.TRANSPORT_OUT,               entry.inTransportOut);
                inMsgCtx.setProperty(Constants.OUT_TRANSPORT_INFO,               entry.inTransportOutInfo);
              }
View Full Code Here

        applicationMsgContext.getAxisService());

    MessageContext createSeqmsgContext = SandeshaUtil
        .createNewRelatedMessageContext(applicationRMMsg, createSequenceOperation);
   
    OperationContext createSeqOpCtx = createSeqmsgContext.getOperationContext();
    String createSeqMsgId = SandeshaUtil.getUUID();
    createSeqmsgContext.setMessageID(createSeqMsgId);
    context.registerOperationContext(createSeqMsgId, createSeqOpCtx);

    RMMsgContext createSeqRMMsg = new RMMsgContext(createSeqmsgContext);
View Full Code Here

   
    if (terminateMessage.getMessageID()==null) {
      terminateMessage.setMessageID(SandeshaUtil.getUUID());
    }

    OperationContext operationContext = terminateMessage.getOperationContext();
    // to receive terminate sequence response messages correctly
    configCtx.registerOperationContext(terminateMessage.getMessageID(), operationContext);
   
    String rmNamespaceValue = SpecSpecificConstants.getRMNamespaceValue(rmsBean.getRMVersion());
View Full Code Here

    String createSeqMsgId = null;
    if (relatesTo != null) {
      createSeqMsgId = relatesTo.getValue();
    } else {
      // Work out the related message from the operation context
      OperationContext context = createSeqResponseRMMsgCtx.getMessageContext().getOperationContext();
      MessageContext createSeq = context.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
      if(createSeq != null) createSeqMsgId = createSeq.getMessageID();
    }
    if(createSeqMsgId == null) {
      String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.relatesToNotAvailable);
      log.error(message);
      throw new SandeshaException(message);
    }

    SenderBeanMgr retransmitterMgr = storageManager.getSenderBeanMgr();
    RMSBeanMgr rmsBeanMgr = storageManager.getRMSBeanMgr();

    RMSBean rmsBean = rmsBeanMgr.retrieve(createSeqMsgId);
    if (rmsBean == null) {
      String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.createSeqEntryNotFound);
      log.debug(message);
      throw new SandeshaException(message);
    }

    // Check that the create sequence response message proves possession of the correct token
    String tokenData = rmsBean.getSecurityTokenData();
    if(tokenData != null) {
      SecurityManager secManager = SandeshaUtil.getSecurityManager(configCtx);
      MessageContext crtSeqResponseCtx = createSeqResponseRMMsgCtx.getMessageContext();
      OMElement body = crtSeqResponseCtx.getEnvelope().getBody();
      SecurityToken token = secManager.recoverSecurityToken(tokenData);
      secManager.checkProofOfPossession(token, body, crtSeqResponseCtx);
    }

    String internalSequenceId = rmsBean.getInternalSequenceID();
    if (internalSequenceId == null || "".equals(internalSequenceId)) {
      String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.tempSeqIdNotSet);
      log.debug(message);
      throw new SandeshaException(message);
    }
    createSeqResponseRMMsgCtx.setProperty(Sandesha2Constants.MessageContextProperties.INTERNAL_SEQUENCE_ID,internalSequenceId);
   
    // Check to see if we have already received a sequence id. If we have then this response is redundant,
    // and we can forget about it.
    // TODO: Should we terminate or close the extra sequence? We can only do that if the new sequence
    // id is different from the one we got back the first time. For now it should be enough to just
    // ignore it, and let it time out.
    if(rmsBean.getSequenceID() != null) {
      if(log.isDebugEnabled())
        log.debug("Exit: CreateSeqResponseMsgProcessor::processInMessage, sequence id is already set. " +
            "Existing id:" + rmsBean.getSequenceID() + ", new id:" + newOutSequenceId);
      return false;
    }

    // Store the new sequence id
    rmsBean.setSequenceID(newOutSequenceId);

    // We should poll for any reply-to that uses the anonymous URI, when MakeConnection
    // is enabled.
    if (Sandesha2Constants.SPEC_VERSIONS.v1_1.equals(createSeqResponseRMMsgCtx.getRMSpecVersion())) {
      SandeshaPolicyBean policy = SandeshaUtil.getPropertyBean(configCtx.getAxisConfiguration());
      if(policy.isEnableMakeConnection()) {
        String acksTo = rmsBean.getAcksToEPR();
        EndpointReference reference = new EndpointReference(acksTo);
        if(acksTo == null || reference.hasAnonymousAddress()) {
          rmsBean.setPollingMode(true);
        }
      }
    }

    // deleting the create sequence sender bean entry.
    retransmitterMgr.delete(createSeqMsgId);
   
    // Remove the create sequence message
    storageManager.removeMessageContext(rmsBean.getCreateSequenceMsgStoreKey());
       
    // processing for accept (offer has been sent)
    Accept accept = createSeqResponsePart.getAccept();
    if (accept != null) {

      // TODO this should be detected in the Fault manager.
      if (rmsBean.getOfferedSequence() == null) {
        String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.accptButNoSequenceOffered);
        log.debug(message);
        throw new SandeshaException(message);
      }

      RMDBean rMDBean = new RMDBean();
     
      EndpointReference acksToEPR = accept.getAcksTo().getEPR();
      rMDBean.setAcksToEPR(acksToEPR.getAddress());
      rMDBean.setSequenceID(rmsBean.getOfferedSequence());
      rMDBean.setNextMsgNoToProcess(1);
      rMDBean.setOutboundInternalSequence(rmsBean.getInternalSequenceID());

      rMDBean.setServiceName(createSeqResponseRMMsgCtx.getMessageContext().getAxisService().getName());
     
      //Storing the referenceMessage of the sending side sequence as the reference message
      //of the receiving side as well.
      //This can be used when creating new outgoing messages.
     
      String referenceMsgStoreKey = rmsBean.getReferenceMessageStoreKey();
      MessageContext referenceMsg = storageManager.retrieveMessageContext(referenceMsgStoreKey, configCtx);
     
      String newMessageStoreKey = SandeshaUtil.getUUID();
      storageManager.storeMessageContext(newMessageStoreKey,referenceMsg);
     
      rMDBean.setReferenceMessageKey(newMessageStoreKey);

      // If this is an offered sequence that needs polling then we need to setup the
      // rmdBean for polling too, so that it still gets serviced after the outbound
      // sequence terminates.
      if (Sandesha2Constants.SPEC_VERSIONS.v1_1.equals(createSeqResponseRMMsgCtx.getRMSpecVersion())) {
        if(rmsBean.isPollingMode()) {
          rMDBean.setPollingMode(true);
        }
      }
     
      String rmSpecVersion = createSeqResponseRMMsgCtx.getRMSpecVersion();
      rMDBean.setRMVersion(rmSpecVersion);
     
      EndpointReference toEPR = createSeqResponseRMMsgCtx.getTo();
      if (toEPR==null) {
        //Most probably this is a sync response message, using the replyTo of the request message
        OperationContext operationContext = createSeqResponseRMMsgCtx.getMessageContext().getOperationContext();
        if (operationContext!=null) {
          MessageContext createSequnceMessage = operationContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
          if (createSequnceMessage!=null)
            toEPR = createSequnceMessage.getReplyTo();
        }
      }
     
View Full Code Here

      newMessageContext.setAxisOperation(operation);

      //The message created will basically be used as a outMessage, so setting the AxisMessage accordingly
      newMessageContext.setAxisMessage(operation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE));
     
      OperationContext operationContext = OperationContextFactory.createOperationContext(operation.getAxisSpecificMEPConstant(), operation, newMessageContext.getServiceContext());
      newMessageContext.setOperationContext(operationContext);
      operationContext.addMessageContext(newMessageContext);

      // adding a blank envelope
      SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil.getSOAPVersion(referenceMessage
          .getEnvelope()));
      newMessageContext.setEnvelope(factory.getDefaultEnvelope());
View Full Code Here

        }
      }
    }
   
    Parameter propertiesFromRefReqMsg = axisModule.getParameter(Sandesha2Constants.propertiesToCopyFromReferenceRequestMessage);
    OperationContext referenceOpCtx = fromMessage.getOperationContext();
    MessageContext referenceRequestMessage = null;
    if (referenceOpCtx!=null)
      referenceRequestMessage=referenceOpCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
   
    if (propertiesFromRefReqMsg!=null && referenceRequestMessage!=null) {
      String value = (String) propertiesFromRefReqMsg.getValue();
      if (value!=null) {
        value = value.trim();
View Full Code Here

   
    // setting the Fault callback
    SandeshaListener faultCallback = (SandeshaListener) msgContext.getOptions().getProperty(
        SandeshaClientConstants.SANDESHA_LISTENER);
    if (faultCallback != null) {
      OperationContext operationContext = msgContext.getOperationContext();
      if (operationContext != null) {
        operationContext.setProperty(SandeshaClientConstants.SANDESHA_LISTENER, faultCallback);
      }
    }

    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configContext, configContext
        .getAxisConfiguration());
View Full Code Here

TOP

Related Classes of org.apache.axis2.context.OperationContext

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.