Package org.apache.axis2.context

Examples of org.apache.axis2.context.OperationContext


                trace.trace("Envelope : " + synCtx.getEnvelope());
            }

            if (synCtx.isResponse()) {
                Axis2MessageContext axis2MsgCtx = (Axis2MessageContext) synCtx;
                OperationContext opCtx = axis2MsgCtx.getAxis2MessageContext().getOperationContext();
                Object o = opCtx.getProperty("endpointList");
                if (o != null && o instanceof List) {
                    // we are in the response of the first message of a server initiated session
                    // so update all session maps
                    List endpointList = (List) o;
                    Object e = endpointList.remove(0);
View Full Code Here


            // this is a start of a new session. so update session map.
            if (dispatcher.isServerInitiatedSession()) {

                // add this endpoint to the endpoint sequence of operation context.
                Axis2MessageContext axis2MsgCtx = (Axis2MessageContext) synMessageContext;
                OperationContext opCtx = axis2MsgCtx.getAxis2MessageContext().getOperationContext();
                Object o = opCtx.getProperty("endpointList");

                if (o != null) {
                    List endpointList = (List) o;
                    endpointList.add(this);

                    // if the next endpoint is not a session affinity one, endpoint sequence ends
                    // here. but we have to add the next endpoint to the list.
                    if (!(endpoint instanceof SALoadbalanceEndpoint)) {
                        endpointList.add(endpoint);
                    }

                } else {

                    // this is the first endpoint in the heirachy. so create the queue and insert
                    // this as the first element.
                    List endpointList = new ArrayList();
                    endpointList.add(this);

                    // if the next endpoint is not a session affinity one, endpoint sequence ends
                    // here. but we have to add the next endpoint to the list.
                    if (!(endpoint instanceof SALoadbalanceEndpoint)) {
                        endpointList.add(endpoint);
                    }

                    opCtx.setProperty("endpointList", endpointList);
                }

            } else {
                dispatcher.updateSession(synMessageContext, endpoint);
            }
View Full Code Here

        org.apache.axis2.context.MessageContext axis2MC
                = new org.apache.axis2.context.MessageContext();
        axis2MC.setConfigurationContext(this.configContext);

        ServiceContext svcCtx = new ServiceContext();
        OperationContext opCtx = new OperationContext(new InOutAxisOperation(), svcCtx);
        axis2MC.setServiceContext(svcCtx);
        axis2MC.setOperationContext(opCtx);
        MessageContext mc = new Axis2MessageContext(axis2MC, synapseConfig, this);
        mc.setMessageID(UUIDGenerator.getUUID());
        try {
View Full Code Here

                    responseMsgCtx.getAxisMessageContext();

            MessageUtils.putMessageOnMessageContext(responseMsgCtx.getMessage(),
                                                    axisResponseMsgCtx);

            OperationContext opCtx = axisResponseMsgCtx.getOperationContext();
            opCtx.addMessageContext(axisResponseMsgCtx);

            // If this is a fault message, we want to throw it as an
            // exception so that the transport can do the appropriate things
            if (responseMsgCtx.getMessage().isFault()) {
                throw new AxisFault("An error was detected during JAXWS processing",
View Full Code Here

            throw new UnsupportedOperationException("[" + request.getMethod() + " ] method not supported");
        }

        // Finalize response
        if (TransportUtils.isResponseWritten(msgContext)) {
            OperationContext operationContext = msgContext.getOperationContext();
            Object isTwoChannel = null;
            if (operationContext != null) {
                isTwoChannel = operationContext.getProperty(Constants.DIFFERENT_EPR);
            }
            if ((isTwoChannel != null) && Constants.VALUE_TRUE.equals(isTwoChannel)) {
                response.setStatusCode(HttpURLConnection.HTTP_ACCEPTED);
                return;
            }
View Full Code Here

      makeConnectionRMMessage.getMessageContext().setServerSide(false);
     
      // Store properties so that we know which sequence we are polling for. This can be used
      // to match reply sequences up to requests, as well as to help process messagePending
      // headers.
      OperationContext ctx = makeConnectionRMMessage.getMessageContext().getOperationContext();
      ctx.setProperty(Sandesha2Constants.MessageContextProperties.MAKECONNECTION_ENTRY, entry);
     
      makeConnectionRMMessage.setProperty(MessageContext.TRANSPORT_IN,null);
      //storing the MakeConnection message.
      String makeConnectionMsgStoreKey = SandeshaUtil.getUUID();
     
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 = rmMsgCtx.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);
View Full Code Here

        // Store a reference to the real message, as well as serializing it
        entry.message = msgContext;
        entry.data = stream.toByteArray();
        entry.context = msgContext.getConfigurationContext();
       
        OperationContext opCtx = msgContext.getOperationContext();
        if(opCtx != null) {
          MessageContext inMsgCtx = opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
          if(inMsgCtx != null) {
            entry.inTransportControl = inMsgCtx.getProperty(RequestResponseTransport.TRANSPORT_CONTROL);
            entry.inTransportOut     = inMsgCtx.getProperty(MessageContext.TRANSPORT_OUT);
            entry.inTransportOutInfo = inMsgCtx.getProperty(Constants.OUT_TRANSPORT_INFO);
          }
View Full Code Here

      // will hopefully pick it up soon.
      Boolean makeConnection = (Boolean) msgCtx.getProperty(Sandesha2Constants.MAKE_CONNECTION_RESPONSE);
      EndpointReference toEPR = msgCtx.getTo();

      MessageContext inMsg = null;
      OperationContext op = msgCtx.getOperationContext();
     
      RequestResponseTransport t = (RequestResponseTransport) msgCtx.getProperty(RequestResponseTransport.TRANSPORT_CONTROL);
     
      if (t==null) {
        if (op != null)
          inMsg = op.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
        if (inMsg != null)
          t = (RequestResponseTransport) inMsg.getProperty(RequestResponseTransport.TRANSPORT_CONTROL);
      }

      // If we are anonymous, and this is not a makeConnection, then we must have a transport waiting
View Full Code Here

     
      if (responseMessageContext==null || responseMessageContext.getEnvelope()==null) {
        if (responseMessageContext==null)
          responseMessageContext = new MessageContext();

        OperationContext requestMsgOpCtx = msgCtx.getOperationContext();
                responseMessageContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, requestMsgOpCtx
                .getProperty(Constants.Configuration.CHARACTER_SET_ENCODING));
        responseMessageContext.setProperty(Constants.Configuration.CONTENT_TYPE, requestMsgOpCtx
                .getProperty(Constants.Configuration.CONTENT_TYPE));
        responseMessageContext.setProperty(HTTPConstants.MTOM_RECEIVED_CONTENT_TYPE, requestMsgOpCtx
                .getProperty(HTTPConstants.MTOM_RECEIVED_CONTENT_TYPE));
//                responseMessageContext.setOperationContext(requestMsgOpCtx);
//                if ( !requestMsgOpCtx.isComplete()) {
//                    requestMsgOpCtx.addMessageContext(responseMessageContext);
//                }
                responseMessageContext.setAxisOperation(msgCtx.getAxisOperation());

                //If the response MsgCtx was not available Axis2 would hv put the transport info into a
        //HashMap, getting the data from it.
        HashMap transportInfoMap = (HashMap) msgCtx.getProperty(Constants.Configuration.TRANSPORT_INFO_MAP);
        if (transportInfoMap != null) {
          responseMessageContext.setProperty(Constants.Configuration.CONTENT_TYPE,
                  transportInfoMap.get(Constants.Configuration.CONTENT_TYPE));
          responseMessageContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING,
                  transportInfoMap.get(Constants.Configuration.CHARACTER_SET_ENCODING));
        }
     
        responseMessageContext.setConfigurationContext(msgCtx.getConfigurationContext());
        responseMessageContext.setTransportIn(msgCtx.getTransportIn());
        responseMessageContext.setTransportOut(msgCtx.getTransportOut());
        responseMessageContext.setProperty(MessageContext.TRANSPORT_IN, msgCtx
            .getProperty(MessageContext.TRANSPORT_IN));
       
        //we will not be setting the operation context here since this msgs may not be an application reply.
        //we let other dispatchers find it.
        responseMessageContext.setServiceContext(msgCtx.getServiceContext());
        responseMessageContext.setServiceGroupContext(msgCtx.getServiceGroupContext());

        responseMessageContext.setProperty(Sandesha2Constants.MessageContextProperties.MAKECONNECTION_ENTRY,
        msgCtx.getProperty(Sandesha2Constants.MessageContextProperties.MAKECONNECTION_ENTRY));

        // If request is REST we assume the responseMessageContext is REST,
        // so set the variable

        responseMessageContext.setDoingREST(msgCtx.isDoingREST());

        resenvelope = responseMessageContext.getEnvelope();
        try {
          // MessageContext is modified in TransportUtils.createSOAPMessage(). It might be used by axis.engine or handler.
          // To catch the modification and pass it to engine or handler, resenvelope is created by responseMessageContext.
          if (resenvelope==null) {
            //We try to build the response out of the transport stream.
            resenvelope = TransportUtils.createSOAPMessage(responseMessageContext);
            responseMessageContext.setEnvelope(resenvelope);
            syncResponseBuilt = true;
          }
        } catch (AxisFault e) {
          //Cannot find a valid SOAP envelope.
          if (log.isErrorEnabled() ) {
            log.error (SandeshaMessageHelper
                .getMessage(SandeshaMessageKeys.soapEnvNotSet));
          log.error ("Caught exception", e);
          }
       
          return true;
        }
       
        //If addressing is disabled we will be adding this message simply as the application response of the request message.
        Boolean addressingDisabled = (Boolean) msgCtx.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
        if (addressingDisabled!=null && Boolean.TRUE.equals(addressingDisabled)) {
          // If the AxisOperation object doesn't have a message receiver, it means that this was
          // an out only op where we have added an ACK to the response.  Set the requestMsgOpCtx to
          // be the RMIn
          OperationContext responseMsgOpCtx = requestMsgOpCtx;
          if (requestMsgOpCtx.getAxisOperation().getMessageReceiver() == null) {
            // Generate a new RM In Only operation

            ServiceContext serviceCtx = responseMessageContext.getServiceContext();
            AxisOperation op = msgCtx.getAxisService().getOperation(Sandesha2Constants.RM_IN_ONLY_OPERATION);
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.