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


Java MessageContext.setOptions方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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


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