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


Java MessageContext.setMessageID方法代码示例

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


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

示例6: testAddToSOAPHeader

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public void testAddToSOAPHeader() throws Exception {
    EndpointReference replyTo = new EndpointReference(
            "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous");
    EndpointReference epr = new EndpointReference("http://www.to.org/service/");

    for (int i = 0; i < 5; i++) {
        epr.addReferenceParameter(
                new QName(Submission.WSA_NAMESPACE, "Reference" + i,
                          AddressingConstants.WSA_DEFAULT_PREFIX),
                "Value " + i * 100);

    }


    SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
    SOAPEnvelope defaultEnvelope = factory.getDefaultEnvelope();

    ConfigurationContext configCtx =
            ConfigurationContextFactory.createEmptyConfigurationContext();
    MessageContext msgCtxt = configCtx.createMessageContext();
    msgCtxt.setProperty(WS_ADDRESSING_VERSION, Submission.WSA_NAMESPACE);
    msgCtxt.setTo(epr);
    msgCtxt.setReplyTo(replyTo);
    msgCtxt.setEnvelope(defaultEnvelope);
    msgCtxt.setWSAAction("http://www.actions.org/action");
    msgCtxt.setMessageID("urn:test:123");

    OMAttribute extAttr = OMAbstractFactory.getOMFactory().createOMAttribute("AttrExt",
                                                                             OMAbstractFactory
                                                                                     .getOMFactory().createOMNamespace(
                                                                                     "http://ws.apache.org/namespaces/axis2",
                                                                                     "axis2"),
                                                                             "123456789");
    ArrayList al = new ArrayList();
    al.add(extAttr);

    msgCtxt.setProperty(AddressingConstants.ACTION_ATTRIBUTES, al);
    msgCtxt.setProperty(AddressingConstants.MESSAGEID_ATTRIBUTES, al);

    outHandler.invoke(msgCtxt);

    OMXMLParserWrapper omBuilder = TestUtil.getOMBuilder("eprTest.xml");

    XMLUnit.setIgnoreWhitespace(true);
    assertXMLEqual(omBuilder.getDocumentElement().toString(), defaultEnvelope.toString());

}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:48,代码来源:AddressingOutHandlerTest.java

示例7: setMessageID

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * Create a message ID for the given message context if needed. If user gives an option with
 * MessageID then just copy that into MessageContext , and with that there can be multiple
 * message with same MessageID unless user call setOption for each invocation.
 * <p/>
 * If user want to give message ID then the better way is to set the message ID in the option and
 * call setOption for each invocation then the right thing will happen.
 * <p/>
 * If user does not give a message ID then the new one will be created and set that into Message
 * Context.
 *
 * @param mc the message context whose id is to be set
 */
protected void setMessageID(MessageContext mc) {
    // now its the time to put the parameters set by the user in to the
    // correct places and to the
    // if there is no message id still, set a new one.
    String messageId = options.getMessageId();
    if (messageId == null || "".equals(messageId)) {
        messageId = UIDGenerator.generateURNString();
    }
    mc.setMessageID(messageId);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:24,代码来源:OperationClient.java


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