当前位置: 首页>>代码示例>>Java>>正文


Java MessageContext.setTransportOut方法代码示例

本文整理汇总了Java中org.apache.axis2.context.MessageContext.setTransportOut方法的典型用法代码示例。如果您正苦于以下问题:Java MessageContext.setTransportOut方法的具体用法?Java MessageContext.setTransportOut怎么用?Java MessageContext.setTransportOut使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.axis2.context.MessageContext的用法示例。


在下文中一共展示了MessageContext.setTransportOut方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createMessageContext

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * Create a new axis MessageContext for an incoming message through this transport
 * @return the newly created message context
 */
public MessageContext createMessageContext() {
    MessageContext msgCtx = new MessageContext();
    msgCtx.setConfigurationContext(cfgCtx);

    msgCtx.setIncomingTransportName(getTransportName());
    msgCtx.setTransportOut(transportOut);
    msgCtx.setTransportIn(transportIn);
    msgCtx.setServerSide(true);
    msgCtx.setMessageID(UUIDGenerator.getUUID());

    // There is a discrepency in what I thought, Axis2 spawns a nes threads to
    // send a message is this is TRUE - and I want it to be the other way
    msgCtx.setProperty(MessageContext.CLIENT_API_NON_BLOCKING, Boolean.valueOf(!isNonBlocking));

    // are these relevant?
    //msgCtx.setServiceGroupContextId(UUIDGenerator.getUUID());
    // this is required to support Sandesha 2
    //msgContext.setProperty(RequestResponseTransport.TRANSPORT_CONTROL,
    //        new HttpCoreRequestResponseTransport(msgContext));

    return msgCtx;
}
 
开发者ID:wso2,项目名称:wso2-axis2-transports,代码行数:27,代码来源:AbstractTransportListener.java

示例2: send

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * Synchronously send the request and receive a response. This relies on the transport correctly connecting the
 * response InputStream!
 *
 * @param msgContext the request MessageContext to send.
 * @return Returns MessageContext.
 * @throws AxisFault Sends the message using a two way transport and waits for a response
 */
protected MessageContext send(final MessageContext msgContext) throws AxisFault {

// create the responseMessageContext
    final MessageContext responseMessageContext
            = msgContext.getConfigurationContext().createMessageContext();

    responseMessageContext.setServerSide(false);
    responseMessageContext.setOperationContext(msgContext.getOperationContext());
    responseMessageContext.setOptions(new Options(options));
    responseMessageContext.setMessageID(msgContext.getMessageID());
    addMessageContext(responseMessageContext);
    responseMessageContext.setServiceContext(msgContext.getServiceContext());
    responseMessageContext.setAxisMessage(
            axisOp.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE));

    //sending the message
    AxisEngine.send(msgContext);

    responseMessageContext.setDoingREST(msgContext.isDoingREST());

// Copy RESPONSE properties which the transport set onto the request message context when it processed
    // the incoming response recieved in reply to an outgoing request.
    responseMessageContext.setProperty(MessageContext.TRANSPORT_HEADERS,
            msgContext.getProperty(MessageContext.TRANSPORT_HEADERS));
    responseMessageContext.setProperty(HTTPConstants.MC_HTTP_STATUS_CODE,
            msgContext.getProperty(HTTPConstants.MC_HTTP_STATUS_CODE));

    responseMessageContext.setProperty(MessageContext.TRANSPORT_IN, msgContext
            .getProperty(MessageContext.TRANSPORT_IN));
    responseMessageContext.setTransportIn(msgContext.getTransportIn());
    responseMessageContext.setTransportOut(msgContext.getTransportOut());
    handleResponse(responseMessageContext);
    return responseMessageContext;
}
 
开发者ID:holodeck-b2b,项目名称:Holodeck-B2B,代码行数:43,代码来源:OutOptInAxisOperation.java

示例3: createMessageContext

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
private MessageContext createMessageContext(OperationContext oc, ConfigurationContext cc,
                                                int flowType) throws Exception {
        MessageContext mc = cc.createMessageContext();

        mc.setFLOW(flowType);
        mc.setTransportIn(transportIn);
        mc.setTransportOut(transportOut);

        mc.setServerSide(true);
//        mc.setProperty(MessageContext.TRANSPORT_OUT, System.out);

        SOAPFactory omFac = OMAbstractFactory.getSOAP11Factory();
        mc.setEnvelope(omFac.getDefaultEnvelope());

        AxisOperation axisOperation = oc.getAxisOperation();
        String action = axisOperation.getName().getLocalPart();
        mc.setSoapAction(action);
//        System.out.flush();

        mc.setMessageID(UUIDGenerator.getUUID());

        axisOperation.registerOperationContext(mc, oc);
        mc.setOperationContext(oc);

        ServiceContext sc = oc.getServiceContext();
        mc.setServiceContext(sc);

        mc.setTo(new EndpointReference("axis2/services/NullService"));
        mc.setWSAAction("DummyOp");

        AxisMessage axisMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
        mc.setAxisMessage(axisMessage);

        return mc;
    }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:36,代码来源:MessageContextSaveCTest.java

示例4: createMessageContext

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
private MessageContext createMessageContext(OperationContext oc) throws Exception {
        MessageContext mc = configurationContext.createMessageContext();
        mc.setTransportIn(transportIn);
        mc.setTransportOut(transportOut);

        mc.setServerSide(true);
//        mc.setProperty(MessageContext.TRANSPORT_OUT, System.out);

        SOAPFactory omFac = OMAbstractFactory.getSOAP11Factory();
        mc.setEnvelope(omFac.getDefaultEnvelope());

        AxisOperation axisOperation = oc.getAxisOperation();
        String action = axisOperation.getName().getLocalPart();
        mc.setSoapAction(action);
//        System.out.flush();

        mc.setMessageID(UUIDGenerator.getUUID());

        axisOperation.registerOperationContext(mc, oc);
        mc.setOperationContext(oc);

        ServiceContext sc = oc.getServiceContext();
        mc.setServiceContext(sc);

        mc.setTo(new EndpointReference("axis2/services/NullService"));
        mc.setWSAAction("DummyOp");

        AxisMessage axisMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
        mc.setAxisMessage(axisMessage);

        return mc;
    }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:33,代码来源:MessageContextSaveBTest.java

示例5: prepareMessageContext

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * prepareMessageContext gets a fresh new MessageContext ready to be sent.
 * It sets up the necessary properties, transport information, etc.
 *
 * @param configurationContext the active ConfigurationContext
 * @param mc the MessageContext to be configured
 * @throws AxisFault if there is a problem
 */
protected void prepareMessageContext(ConfigurationContext configurationContext,
                                     MessageContext mc)
        throws AxisFault {
    // set options on the message context
    if (mc.getSoapAction() == null || "".equals(mc.getSoapAction())) {
        mc.setSoapAction(options.getAction());
    }

    mc.setOptions(new Options(options));
    mc.setAxisMessage(axisOp.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE));

    // do Target Resolution
    TargetResolver targetResolver =
            configurationContext.getAxisConfiguration().getTargetResolverChain();
    if (targetResolver != null) {
        targetResolver.resolveTarget(mc);
    }
    // if the transport to use for sending is not specified, try to find it
    // from the URL
    TransportOutDescription senderTransport = options.getTransportOut();
    if (senderTransport == null) {
        EndpointReference toEPR = (options.getTo() != null) ? options
                .getTo() : mc.getTo();
        senderTransport = ClientUtils.inferOutTransport(configurationContext
                .getAxisConfiguration(), toEPR, mc);
    }
    mc.setTransportOut(senderTransport);
    if (options.getParent() !=null && options.getParent().isManageSession()) {
        mc.getOptions().setManageSession(true);
    } else if (options.isManageSession()) {
        mc.getOptions().setManageSession(true);
    }
    addReferenceParameters(mc);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:43,代码来源:OperationClient.java

示例6: send

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * Synchronously send the request and receive a response.  This relies on the transport
 * correctly connecting the response InputStream!
 *
 * @param msgContext the request MessageContext to send.
 * @return Returns MessageContext.
 * @throws AxisFault Sends the message using a two way transport and waits for a response
 */
protected MessageContext send(MessageContext msgContext) throws AxisFault {

    // create the responseMessageContext

    MessageContext responseMessageContext =
            msgContext.getConfigurationContext().createMessageContext();

    responseMessageContext.setServerSide(false);
    responseMessageContext.setOperationContext(msgContext.getOperationContext());
    responseMessageContext.setOptions(new Options(options));
    responseMessageContext.setMessageID(msgContext.getMessageID());
    addMessageContext(responseMessageContext);
    responseMessageContext.setServiceContext(msgContext.getServiceContext());
    responseMessageContext.setAxisMessage(
            axisOp.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE));

    //sending the message
    AxisEngine.send(msgContext);

    responseMessageContext.setDoingREST(msgContext.isDoingREST());

    // Copy RESPONSE properties which the transport set onto the request message context when it processed
    // the incoming response recieved in reply to an outgoing request.
    responseMessageContext.setProperty(MessageContext.TRANSPORT_HEADERS,
            msgContext.getProperty(MessageContext.TRANSPORT_HEADERS));
    responseMessageContext.setProperty(HTTPConstants.MC_HTTP_STATUS_CODE,
            msgContext.getProperty(HTTPConstants.MC_HTTP_STATUS_CODE));

    responseMessageContext.setProperty(MessageContext.TRANSPORT_IN, msgContext
            .getProperty(MessageContext.TRANSPORT_IN));
    responseMessageContext.setTransportIn(msgContext.getTransportIn());
    responseMessageContext.setTransportOut(msgContext.getTransportOut());
    handleResponse(responseMessageContext);
    return responseMessageContext;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:44,代码来源:OutInAxisOperation.java

示例7: setupCorrectTransportOut

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * Ensure that if the scheme of the To EPR for the response is different than the
 * transport used for the request that the correct TransportOut is available
 */
private static void setupCorrectTransportOut(MessageContext context) throws AxisFault {
    // Determine that we have the correct transport available.
    TransportOutDescription transportOut = context.getTransportOut();

    try {
        EndpointReference responseEPR = context.getTo();
        if (context.isServerSide() && responseEPR != null) {
            if (!responseEPR.hasAnonymousAddress() && !responseEPR.hasNoneAddress()) {
                URI uri = new URI(responseEPR.getAddress());
                String scheme = uri.getScheme();
                if ((transportOut == null) || !transportOut.getName().equals(scheme)) {
                    ConfigurationContext configurationContext =
                            context.getConfigurationContext();
                    transportOut = configurationContext.getAxisConfiguration()
                            .getTransportOut(scheme);
                    if (transportOut == null) {
                        throw new AxisFault("Can not find the transport sender : " + scheme);
                    }
                    context.setTransportOut(transportOut);
                }
                if (context.getOperationContext() != null) {
                    context.getOperationContext().setProperty(
                            Constants.DIFFERENT_EPR, Constants.VALUE_TRUE);
                }
            }
        }
    } catch (URISyntaxException urise) {
        throw AxisFault.makeFault(urise);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:35,代码来源:MessageContextBuilder.java

示例8: buildMessaage

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public MessageContext buildMessaage(SMSMessage msg,ConfigurationContext configurationContext)
        throws InvalidMessageFormatException {
    String message = msg.getContent();
    String sender =  msg.getSender();
    String receiver = msg.getReceiver();
    String[] parts = message.split(":");


    //may be can add feature to send message format for a request like ????
    if (parts.length < 2) {
        throw new InvalidMessageFormatException("format must be  \"service_name \" : \"opration_name\" : " +
                "\"parm_1=val_1\" :..:\"param_n = val_n\"");
    } else {
        AxisConfiguration repo = configurationContext.getAxisConfiguration();
        MessageContext messageContext = configurationContext.createMessageContext();

        parts = trimSplited(parts);

        try {
            AxisService axisService = repo.getService(parts[0]);
            if (axisService == null) {

                throw new InvalidMessageFormatException("Service : " + parts[0] + "does not exsist");

            } else {
                messageContext.setAxisService(axisService);
                AxisOperation axisOperation = axisService.getOperation(new QName(parts[1]));

                if (axisOperation == null) {
                    throw new InvalidMessageFormatException("Operation: " + parts[1] + " does not exsist");
                }

                messageContext.setAxisOperation(axisOperation);

                messageContext.setAxisMessage(axisOperation.getMessage(
                        WSDLConstants.MESSAGE_LABEL_IN_VALUE));

                Map params = getParams(parts,2);

                SOAPEnvelope soapEnvelope = createSoapEnvelope(messageContext , params);
                messageContext.setServerSide(true);
                messageContext.setEnvelope(soapEnvelope);
                TransportInDescription in = configurationContext.getAxisConfiguration().getTransportIn("sms");
                TransportOutDescription out = configurationContext.getAxisConfiguration().getTransportOut("sms");
                messageContext.setIncomingTransportName("sms");
                messageContext.setProperty(SMSTransportConstents.SEND_TO , sender);
                messageContext.setProperty(SMSTransportConstents.DESTINATION , receiver);
                messageContext.setTransportIn(in);
                messageContext.setTransportOut(out);
                handleSMSProperties(msg , messageContext);
                return messageContext;
            }


        } catch (AxisFault axisFault) {
            log.debug("[DefaultSMSMessageBuilderImpl] Error while extracting the axis2Service \n" +
                    axisFault);
        }

    }


    return null;
}
 
开发者ID:wso2,项目名称:wso2-axis2-transports,代码行数:65,代码来源:DefaultSMSMessageBuilderImpl.java

示例9: createMessageContext

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * Creates message context using values received in XMPP packet
 * @param packet
 * @return MessageContext
 * @throws AxisFault
 */
private MessageContext createMessageContext(Packet packet) throws AxisFault {
	Message message = (Message) packet;		

	Boolean isServerSide = (Boolean) message
			.getProperty(XMPPConstants.IS_SERVER_SIDE);
	String serviceName = (String) message
			.getProperty(XMPPConstants.SERVICE_NAME);
	String action = (String) message.getProperty(XMPPConstants.ACTION);
	MessageContext msgContext = null;

	TransportInDescription transportIn = configurationContext
			.getAxisConfiguration().getTransportIn("xmpp");
	TransportOutDescription transportOut = configurationContext
			.getAxisConfiguration().getTransportOut("xmpp");
	if ((transportIn != null) && (transportOut != null)) {
		msgContext = configurationContext.createMessageContext();
		msgContext.setTransportIn(transportIn);
		msgContext.setTransportOut(transportOut);
		if (isServerSide != null) {
			msgContext.setServerSide(isServerSide.booleanValue());
		}
		msgContext.setProperty(
				CONTENT_TYPE,
				"text/xml");
		msgContext.setProperty(
				Constants.Configuration.CHARACTER_SET_ENCODING, "UTF-8");
		msgContext.setIncomingTransportName("xmpp");

		Map services = configurationContext.getAxisConfiguration()
				.getServices();

		AxisService axisService = (AxisService) services.get(serviceName);
		msgContext.setAxisService(axisService);
		msgContext.setSoapAction(action);

		// pass the configurationFactory to transport sender
		msgContext.setProperty("XMPPConfigurationFactory",
				this.xmppConnectionFactory);

		if (packet.getFrom() != null) {
			msgContext.setFrom(new EndpointReference(packet.getFrom()));
		}
		if (packet.getTo() != null) {
			msgContext.setTo(new EndpointReference(packet.getTo()));
		}

		XMPPOutTransportInfo xmppOutTransportInfo = new XMPPOutTransportInfo();
		xmppOutTransportInfo
				.setConnectionFactory(this.xmppConnectionFactory);

		String packetFrom = packet.getFrom();
		if (packetFrom != null) {
			EndpointReference fromEPR = new EndpointReference(packetFrom);
			xmppOutTransportInfo.setFrom(fromEPR);
			xmppOutTransportInfo.setDestinationAccount(packetFrom);
		}

		// Save Message-Id to set as In-Reply-To on reply
		String xmppMessageId = packet.getPacketID();
		if (xmppMessageId != null) {
			xmppOutTransportInfo.setInReplyTo(xmppMessageId);
		}
		xmppOutTransportInfo.setSequenceID((String)message.getProperty(XMPPConstants.SEQUENCE_ID));
		msgContext.setProperty(
				org.apache.axis2.Constants.OUT_TRANSPORT_INFO,
				xmppOutTransportInfo);
		buildSOAPEnvelope(packet, msgContext);
	} else {
		throw new AxisFault("Either transport in or transport out is null");
	}
	return msgContext;
}
 
开发者ID:wso2,项目名称:wso2-axis2-transports,代码行数:79,代码来源:XMPPPacketListener.java

示例10: handleResponse

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
   * Retrieves the properties from the proxyOutMessageContext and sets the values to the
   * inMessageContext.
   *
   * @param proxyOutMessageContext the active message context
   * @param initialMessageContext  the initial message context, which was stored as a property
   *                               in the proxyOutMessageContext
   * @throws AxisFault AxisFault
   */
  private void handleResponse(MessageContext proxyOutMessageContext, MessageContext initialMessageContext) throws AxisFault {
      MessageContext inMessageContext = initialMessageContext.getOperationContext().
              getMessageContext(WSDL2Constants.MESSAGE_LABEL_IN);

      // setting the properties
Iterator<String> initialPropertyIterator = proxyOutMessageContext.getPropertyNames();
if (initialPropertyIterator != null) {
	while (initialPropertyIterator.hasNext()) {
		String strKey = initialPropertyIterator.next();
		Object paramObj = proxyOutMessageContext.getProperty(strKey);
		if (paramObj != null) {
			inMessageContext.setProperty(strKey, paramObj);
		}
	}
} 

      inMessageContext.setEnvelope(getEnvelope(proxyOutMessageContext));
      inMessageContext.setAxisServiceGroup(initialMessageContext.getAxisServiceGroup());
      inMessageContext.setAxisService(initialMessageContext.getAxisService());
      inMessageContext.setAxisOperation(initialMessageContext.getAxisOperation());
      inMessageContext.setAxisMessage(initialMessageContext.getAxisOperation().getMessage(
              WSDLConstants.MESSAGE_LABEL_OUT_VALUE));
      inMessageContext.setIncomingTransportName(Constants.TRANSPORT_LOCAL);
      inMessageContext.setServiceContext(initialMessageContext.getServiceContext());

      // set properties on response
      inMessageContext.setServerSide(true);
      inMessageContext.setProperty(MessageContext.TRANSPORT_OUT,
              initialMessageContext.getProperty(MessageContext.TRANSPORT_OUT));
      inMessageContext.setProperty(Constants.OUT_TRANSPORT_INFO,
              initialMessageContext.getProperty(Constants.OUT_TRANSPORT_INFO));
      inMessageContext.setTransportIn(initialMessageContext.getTransportIn());
      inMessageContext.setTransportOut(initialMessageContext.getTransportOut());

      if (log.isDebugEnabled()) {
          log.debug("Setting AxisServiceGroup - " + initialMessageContext.getAxisServiceGroup());
          log.debug("Setting AxisService - " + initialMessageContext.getAxisService());
          log.debug("Setting AxisOperation - " + initialMessageContext.getAxisOperation());
          log.debug("Setting AxisMessage - " + initialMessageContext.getAxisOperation().
                  getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE));
          log.debug("Setting Incoming Transport name - " + Constants.TRANSPORT_LOCAL);
          log.debug("Setting Service Context " + initialMessageContext.getServiceGroupContext().toString());

          log.debug("Setting ServerSide to true");
          log.debug("Setting " + MessageContext.TRANSPORT_OUT + " property to " +
                  initialMessageContext.getProperty(MessageContext.TRANSPORT_OUT));
          log.debug("Setting " + Constants.OUT_TRANSPORT_INFO + " property to " +
                  initialMessageContext.getProperty(Constants.OUT_TRANSPORT_INFO));
          log.debug("Setting TransportIn - " + initialMessageContext.getTransportIn());
          log.debug("Setting TransportOut - " + initialMessageContext.getTransportOut());

          log.debug("Setting ReplyTo - " + initialMessageContext.getReplyTo());
          log.debug("Setting FaultTo - " + initialMessageContext.getFaultTo());
      }

      // copy the message type property that is used by the out message to the response message
      inMessageContext.setProperty(Constants.Configuration.MESSAGE_TYPE,
              initialMessageContext.getProperty(Constants.Configuration.MESSAGE_TYPE));

      if (initialMessageContext.getMessageID() != null) {
          inMessageContext.setRelationships(
                  new RelatesTo[]{new RelatesTo(initialMessageContext.getMessageID())});
      }

      inMessageContext.setReplyTo(initialMessageContext.getReplyTo());
      inMessageContext.setFaultTo(initialMessageContext.getFaultTo());

      AxisEngine.receive(inMessageContext);
  }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:79,代码来源:LocalResponder.java

示例11: createMessageContext

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * @param request
 * @param response
 * @param invocationType : If invocationType=true; then this will be used in SOAP message
 *                       invocation. If invocationType=false; then this will be used in REST message invocation.
 * @return MessageContext
 * @throws IOException
 */
protected MessageContext createMessageContext(HttpServletRequest request,
                                              HttpServletResponse response,
                                              boolean invocationType) throws IOException {
    MessageContext msgContext = configContext.createMessageContext();
    String requestURI = request.getRequestURI();

    String trsPrefix = request.getRequestURL().toString();
    int sepindex = trsPrefix.indexOf(':');
    if (sepindex > -1) {
        trsPrefix = trsPrefix.substring(0, sepindex);
        msgContext.setIncomingTransportName(trsPrefix);
    } else {
        msgContext.setIncomingTransportName(Constants.TRANSPORT_HTTP);
        trsPrefix = Constants.TRANSPORT_HTTP;
    }
    TransportInDescription transportIn =
            axisConfiguration.getTransportIn(msgContext.getIncomingTransportName());
    //set the default output description. This will be http

    TransportOutDescription transportOut = axisConfiguration.getTransportOut(trsPrefix);
    if (transportOut == null) {
        // if the req coming via https but we do not have a https sender
        transportOut = axisConfiguration.getTransportOut(Constants.TRANSPORT_HTTP);
    }


    msgContext.setTransportIn(transportIn);
    msgContext.setTransportOut(transportOut);
    msgContext.setServerSide(true);

    if (!invocationType) {
        String query = request.getQueryString();
        if (query != null) {
            requestURI = requestURI + "?" + query;
        }
    }

    msgContext.setTo(new EndpointReference(requestURI));
    msgContext.setFrom(new EndpointReference(request.getRemoteAddr()));
    msgContext.setProperty(MessageContext.REMOTE_ADDR, request.getRemoteAddr());
    msgContext.setProperty(Constants.OUT_TRANSPORT_INFO,
            new ServletBasedOutTransportInfo(response));
    // set the transport Headers
    msgContext.setProperty(MessageContext.TRANSPORT_HEADERS, getTransportHeaders(request));
    msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST, request);
    msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETRESPONSE, response);
    try {
        ServletContext context = getServletContext();
        if(context != null) {
            msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT, context);
        }
    } catch (Exception e){
        log.debug(e.getMessage(), e);
    }

    //setting the RequestResponseTransport object
    msgContext.setProperty(RequestResponseTransport.TRANSPORT_CONTROL,
            new ServletRequestResponseTransport());

    return msgContext;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:70,代码来源:AxisServlet.java

示例12: createResponseMessageContext

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * Creates a new 'response' message context based on a 'request' message context
 * Only deals with properties/fields that are the same for both 'normal' and fault responses.
 *
 * @param inMessageContext context for which the response will be created
 * @return response message context for the given in message context
 * @throws org.apache.axis2.AxisFault error in creating the response message context
 */
private static MessageContext createResponseMessageContext(MessageContext inMessageContext)
        throws AxisFault {
    MessageContext newmsgCtx =
            inMessageContext.getConfigurationContext().createMessageContext();

    newmsgCtx.setSessionContext(inMessageContext.getSessionContext());
    newmsgCtx.setTransportIn(inMessageContext.getTransportIn());
    newmsgCtx.setTransportOut(inMessageContext.getTransportOut());
    newmsgCtx.setServerSide(inMessageContext.isServerSide());
    newmsgCtx.setProperty(MessageContext.IN_MESSAGE_CONTEXT, inMessageContext);

    // TODO: Should this be specifying (or defaulting to) the "response" relationshipType??
    newmsgCtx.addRelatesTo(new RelatesTo(inMessageContext.getOptions().getMessageId()));

    newmsgCtx.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,
                          inMessageContext.getProperty(
                                  AddressingConstants.WS_ADDRESSING_VERSION));
    newmsgCtx.setProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
                          inMessageContext.getProperty(
                                  AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES));

    newmsgCtx.setProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME,
                          inMessageContext.getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME));
    newmsgCtx.setProperty(Constants.AXIS_BINDING_OPERATION,
                          inMessageContext.getProperty(Constants.AXIS_BINDING_OPERATION));

    // Setting the charater set encoding
    newmsgCtx.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING,
                          inMessageContext.getProperty(
                                  Constants.Configuration.CHARACTER_SET_ENCODING));
    //Setting the message type property
    newmsgCtx.setProperty(Constants.Configuration.MESSAGE_TYPE,
                          inMessageContext.getProperty(Constants.Configuration.MESSAGE_TYPE));
    newmsgCtx.setDoingREST(inMessageContext.isDoingREST());

    newmsgCtx.setOperationContext(inMessageContext.getOperationContext());

    newmsgCtx.setProperty(MessageContext.TRANSPORT_OUT,
                          inMessageContext.getProperty(MessageContext.TRANSPORT_OUT));
    newmsgCtx.setProperty(Constants.OUT_TRANSPORT_INFO,
                          inMessageContext.getProperty(Constants.OUT_TRANSPORT_INFO));

    handleCorrelationID(inMessageContext,newmsgCtx);
    return newmsgCtx;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:54,代码来源:MessageContextBuilder.java


注:本文中的org.apache.axis2.context.MessageContext.setTransportOut方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。