Package org.apache.axis2.context

Examples of org.apache.axis2.context.OperationContext


    }

    // TODO optimize by cloning the Map rather than copying one by one.

    // operationContext properties
    OperationContext oldOpContext = relatedMessage.getOperationContext();
    if (oldOpContext != null) {
      Map oldOpContextProperties = oldOpContext.getProperties();
      if (oldOpContextProperties != null) {
        OperationContext newOpContext = newMessage.getOperationContext();
        Iterator keyIter = oldOpContextProperties.keySet().iterator();
        while (keyIter.hasNext()) {
          String key = (String) keyIter.next();
          newOpContext.setProperty(key, oldOpContextProperties.get(key));
        }
      }
    }

    // MessageContext properties
View Full Code Here


      createSeqmsgContext = SandeshaUtil
          .createNewRelatedMessageContext(applicationRMMsg, createSequenceOperation);
     
      initializeCreation(applicationMsgContext, createSeqmsgContext);

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

    } catch (AxisFault e) {
      throw new SandeshaException(e.getMessage());
    }

    AxisOperation appMsgOperationDesc = applicationMsgContext.getAxisOperation();

    AxisOperation createSeqOperation = createSeqmsgContext.getAxisOperation();

    createSeqOperation.setName(new QName(Sandesha2Constants.RM_IN_OUT_OPERATION_NAME));
    if (appMsgOperationDesc != null) {
      createSeqOperation.setPhasesOutFlow(appMsgOperationDesc.getPhasesOutFlow());
      createSeqOperation.setPhasesOutFaultFlow(appMsgOperationDesc.getPhasesOutFaultFlow());
      createSeqOperation.setPhasesInFaultFlow(appMsgOperationDesc.getPhasesInFaultFlow());
      createSeqOperation.setRemainingPhasesInFlow(appMsgOperationDesc.getRemainingPhasesInFlow());
    }

    createSeqmsgContext.setAxisOperation(createSeqOperation);
           
    RMMsgContext createSeqRMMsg = new RMMsgContext(createSeqmsgContext);

    String rmVersion = SandeshaUtil.getRMVersion(sequencePropertyKey, storageManager);
    if (rmVersion == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.cannotDecideRMVersion));

    String rmNamespaceValue = SpecSpecificConstants.getRMNamespaceValue(rmVersion);

    String addressingNamespaceValue = SandeshaUtil.getSequenceProperty(sequencePropertyKey,
        Sandesha2Constants.SequenceProperties.ADDRESSING_NAMESPACE_VALUE, storageManager);

    CreateSequence createSequencePart = new CreateSequence(rmNamespaceValue, addressingNamespaceValue);

    // Adding sequence offer - if present
    OperationContext operationcontext = applicationMsgContext.getOperationContext();
    if (operationcontext != null) {
      String offeredSequence = (String) applicationMsgContext
          .getProperty(SandeshaClientConstants.OFFERED_SEQUENCE_ID);
      EndpointReference offeredEndpoint = (EndpointReference) applicationMsgContext
          .getProperty(SandeshaClientConstants.OFFERED_ENDPOINT);
View Full Code Here

      throw new SandeshaException(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.configContextNotSet));

    MessageContext terminateMessage = SandeshaUtil.createNewRelatedMessageContext(referenceRMMessage,
        terminateOperation);

    OperationContext operationContext = terminateMessage.getOperationContext();
    configCtx.registerOperationContext(terminateMessage.getMessageID(), operationContext); // to
                                                // receive
                                                // terminate
                                                // sequence
                                                // response
View Full Code Here

      if (rmMsgCtx.getMessageContext().getOperationContext() == null) {
        // operation context will be null when doing in a GLOBAL
        // handler.
        try {
          AxisOperation op = AxisOperationFactory.getAxisOperation(WSDL20_2004Constants.MEP_CONSTANT_IN_OUT);
          OperationContext opCtx = new OperationContext(op);
          rmMsgCtx.getMessageContext().setAxisOperation(op);
          rmMsgCtx.getMessageContext().setOperationContext(opCtx);
        } catch (AxisFault e2) {
          throw new SandeshaException(e2.getMessage());
        }
View Full Code Here

    // setting flows
    // outInAxisOp.setRemainingPhasesInFlow(referenceInOutOperation.getRemainingPhasesInFlow());
    outInAxisOp.setRemainingPhasesInFlow(referenceInOutOperation
        .getRemainingPhasesInFlow());

    OperationContext opcontext = OperationContextFactory
        .createOperationContext(
            WSDL20_2004Constants.MEP_CONSTANT_OUT_IN, outInAxisOp);
    opcontext.setParent(msgContext.getServiceContext());
    configurationContext.registerOperationContext(ackRequestRMMsg.getMessageId(),
        opcontext);

    msgContext.setOperationContext(opcontext);
    msgContext.setAxisOperation(outInAxisOp);
View Full Code Here

    // setting the addressing version
    String addressingNamespace = (String) firstAplicationMsgCtx
        .getProperty(AddressingConstants.WS_ADDRESSING_VERSION);

    if (addressingNamespace == null) {
      OperationContext opCtx = firstAplicationMsgCtx.getOperationContext();
      if (opCtx != null) {
        try {
          MessageContext requestMsg = opCtx.getMessageContext(OperationContextFactory.MESSAGE_LABEL_IN_VALUE);
          if (requestMsg != null)
            addressingNamespace = (String) requestMsg
                .getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
        } catch (AxisFault e) {
          throw new SandeshaException(e);
        }
      }
    }

    if (addressingNamespace == null)
      addressingNamespace = AddressingConstants.Final.WSA_NAMESPACE; // defaults
                                      // to
                                      // Final.
                                      // Make
                                      // sure
                                      // this
                                      // is
                                      // synchronized
                                      // with
                                      // addressing.

    SequencePropertyBean addressingNamespaceBean = new SequencePropertyBean(sequencePropertyKey,
        Sandesha2Constants.SequenceProperties.ADDRESSING_NAMESPACE_VALUE, addressingNamespace);
    seqPropMgr.insert(addressingNamespaceBean);
   
   
    //setting the SOAPVersion Bean.
    String SOAPVersion = firstAplicationMsgCtx.getOptions().getSoapVersionURI();
    SequencePropertyBean SOAPVersionBean = new SequencePropertyBean (sequencePropertyKey,
        Sandesha2Constants.SequenceProperties.SOAP_VERSION, SOAPVersion);
   
    seqPropMgr.insert(SOAPVersionBean);
   

    String anonymousURI = SpecSpecificConstants.getAddressingAnonymousURI(addressingNamespace);

    EndpointReference toEPR = firstAplicationMsgCtx.getTo();
    String acksTo = (String) firstAplicationMsgCtx.getProperty(SandeshaClientConstants.AcksTo);

    if (toEPR == null) {
      String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.toEPRNotValid, null);
      log.debug(message);
      throw new SandeshaException(message);
    }

    SequencePropertyBean toBean = new SequencePropertyBean(sequencePropertyKey,
        Sandesha2Constants.SequenceProperties.TO_EPR, toEPR.getAddress());
    SequencePropertyBean replyToBean = null;
    SequencePropertyBean acksToBean = null;

    if (firstAplicationMsgCtx.isServerSide()) {
      // setting replyTo value, if this is the server side.
      OperationContext opContext = firstAplicationMsgCtx.getOperationContext();
      try {
        MessageContext requestMessage = opContext
            .getMessageContext(OperationContextFactory.MESSAGE_LABEL_IN_VALUE);
        if (requestMessage == null) {
          String message = SandeshaMessageHelper
              .getMessage(SandeshaMessageKeys.cannotFindReqMsgFromOpContext);
          log.error(message);
View Full Code Here

    // setting flows
    // outInAxisOp.setRemainingPhasesInFlow(referenceInOutOperation.getRemainingPhasesInFlow());
    outInAxisOp.setRemainingPhasesInFlow(referenceInOutOperation
        .getRemainingPhasesInFlow());

    OperationContext opcontext = OperationContextFactory
        .createOperationContext(
            WSDL20_2004Constants.MEP_CONSTANT_OUT_IN, outInAxisOp);
    opcontext.setParent(msgContext.getServiceContext());
    configurationContext.registerOperationContext(rmMsgCtx.getMessageId(),
        opcontext);

    msgContext.setOperationContext(opcontext);
    msgContext.setAxisOperation(outInAxisOp);
View Full Code Here

//        service.addChild(operation);
       
        operation.setParent(service);
      }

      OperationContext operationContext = new OperationContext(operation);
      newMessageContext.setOperationContext(operationContext);
      operationContext.addMessageContext(newMessageContext);

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

      newMessageContext.setTransportIn(referenceMessage.getTransportIn());
      newMessageContext.setTransportOut(referenceMessage.getTransportOut());

      copyNecessaryPropertiesFromRelatedContext(referenceMessage, newMessageContext);

      // copying transport info.
      newMessageContext.setProperty(MessageContext.TRANSPORT_OUT, referenceMessage
          .getProperty(MessageContext.TRANSPORT_OUT));

      newMessageContext.setProperty(Constants.OUT_TRANSPORT_INFO, referenceMessage
          .getProperty(Constants.OUT_TRANSPORT_INFO));
      newMessageContext.setProperty(MessageContext.TRANSPORT_HEADERS, referenceMessage
          .getProperty(MessageContext.TRANSPORT_HEADERS));
      newMessageContext.setProperty(MessageContext.TRANSPORT_IN, referenceMessage
          .getProperty(MessageContext.TRANSPORT_IN));
      newMessageContext.setProperty(MessageContext.TRANSPORT_OUT, referenceMessage
          .getProperty(MessageContext.TRANSPORT_OUT));
     

      //copyint properties as configured in the module.xml properties. Module xml has several
      //properties which gives comma seperated lists of property names that have to be copited
      //from various places when creating related messages.
     
      AxisModule axisModule = SandeshaUtil.getAxisModule();

      Parameter propertiesFromRefMsg = axisModule.getParameter(Sandesha2Constants.propertiesToCopyFromReferenceMessage);
      if (propertiesFromRefMsg!=null) {
        String value = (String) propertiesFromRefMsg.getValue();
        if (value!=null) {
          value = value.trim();
          String[] propertyNames = value.split(",");
          for (int i=0;i<propertyNames.length;i++) {
            String propertyName = propertyNames[i];
            Object val = referenceMessage.getProperty(propertyName);
            if (val!=null) {
              newMessageContext.setProperty(propertyName,val);
            }
          }
        }
      }
     
      Parameter propertiesFromRefReqMsg = axisModule.getParameter(Sandesha2Constants.propertiesToCopyFromReferenceRequestMessage);
      OperationContext referenceOpCtx = referenceMessage.getOperationContext();
      MessageContext referenceRequestMessage = null;
      if (referenceOpCtx!=null)
        referenceRequestMessage=referenceOpCtx.getMessageContext(OperationContextFactory.MESSAGE_LABEL_IN_VALUE);
     
      if (propertiesFromRefReqMsg!=null && referenceRequestMessage!=null) {
        String value = (String) propertiesFromRefReqMsg.getValue();
        if (value!=null) {
          value = value.trim();
View Full Code Here

    toMessage.setProperty(MessageContextConstants.TRANSPORT_URL, fromMessage
        .getProperty(MessageContextConstants.TRANSPORT_URL));
   
    String addressingVersion = (String) fromMessage.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
    if (addressingVersion==null) {
      OperationContext opCtx = fromMessage.getOperationContext();
      if (opCtx!=null) {
        try {
          MessageContext requestMsg = opCtx.getMessageContext(OperationContextFactory.MESSAGE_LABEL_IN_VALUE);
          if (requestMsg!=null)
            addressingVersion = (String) requestMsg.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
        } catch (AxisFault e) {
          throw new SandeshaException (e);
        }
View Full Code Here

            }
        }


        AxisOperation ao = as.getOperation(EMPTY_OPERATION);
        OperationContext oc =
                OperationContextFactory.createOperationContext(
                        ao.getAxisSpecifMEPConstant(),
                        ao);
        ao.registerOperationContext(mc, oc);

        ServiceContext sc = Utils.fillContextInformation(as, cc);
        oc.setParent(sc);
        mc.setAxisOperation(ao);
        mc.setAxisService(as);


    }
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.