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


Java MessageContext.setSoapAction方法代码示例

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


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

示例1: testEmptyAction

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public void testEmptyAction() throws Exception {
    // We shouldn't be able to route on an emtpy-string action.
    MessageContext messageContext = new MessageContext();
    AxisService as = new AxisService("Service1");
    messageContext.setAxisService(as);

    AxisOperation operation1 = new InOnlyAxisOperation(new QName("operation1"));
    operation1.setSoapAction("");

    AxisOperation operation2 = new InOnlyAxisOperation(new QName("operation2"));
    operation2.setSoapAction("");

    as.addOperation(operation1);
    as.addOperation(operation2);

    messageContext.setSoapAction("");

    SOAPActionBasedDispatcher soapActionDispatcher = new SOAPActionBasedDispatcher();
    soapActionDispatcher.invoke(messageContext);
    assertNull(messageContext.getAxisOperation());
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:22,代码来源:SOAPActionBasedDispatcherTest.java

示例2: createMessageContext

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public MessageContext createMessageContext() throws AxisFault {
    MessageContext msgContext = listener.createMessageContext();
    
    if (service != null) {
        msgContext.setAxisService(service);

        // find the operation for the message, or default to one
        Parameter operationParam = service.getParameter(BaseConstants.OPERATION_PARAM);
        QName operationQName = (
            operationParam != null ?
                BaseUtils.getQNameFromString(operationParam.getValue()) :
                BaseConstants.DEFAULT_OPERATION);

        AxisOperation operation = service.getOperation(operationQName);
        if (operation != null) {
            msgContext.setAxisOperation(operation);
            msgContext.setAxisMessage(
                    operation.getMessage(WSDL2Constants.MESSAGE_LABEL_IN));
            msgContext.setSoapAction("urn:" + operation.getName().getLocalPart());
        }
    }
    return msgContext;
}
 
开发者ID:wso2,项目名称:wso2-axis2-transports,代码行数:24,代码来源:ProtocolEndpoint.java

示例3: testFindOperation

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public void testFindOperation() throws Exception {
    ConfigurationContext cc = new ConfigurationContext(new AxisConfiguration());
    MessageContext messageContext = cc.createMessageContext();
    AxisService as = new AxisService("Service1");
    messageContext.setAxisService(as);

    AxisOperation operation1 = new InOnlyAxisOperation(new QName("operation1"));
    operation1.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation1");

    AxisOperation operation2 = new InOnlyAxisOperation(new QName("operation2"));
    operation2.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation2");

    as.addOperation(operation1);
    as.addOperation(operation2);

    messageContext.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation1");

    SOAPActionBasedDispatcher soapActionDispatcher = new SOAPActionBasedDispatcher();
    soapActionDispatcher.invoke(messageContext);
    assertEquals(operation1, messageContext.getAxisOperation());
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:22,代码来源:SOAPActionBasedDispatcherTest.java

示例4: testNullAction

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public void testNullAction() throws Exception {
    // We shouldn't be able to route on a null action.
    MessageContext messageContext = new MessageContext();
    AxisService as = new AxisService("Service1");
    messageContext.setAxisService(as);

    AxisOperation operation1 = new InOnlyAxisOperation(new QName("operation1"));
    operation1.setSoapAction(null);

    AxisOperation operation2 = new InOnlyAxisOperation(new QName("operation2"));
    operation2.setSoapAction(null);

    as.addOperation(operation1);
    as.addOperation(operation2);

    messageContext.setSoapAction(null);

    SOAPActionBasedDispatcher soapActionDispatcher = new SOAPActionBasedDispatcher();
    soapActionDispatcher.invoke(messageContext);
    assertNull(messageContext.getAxisOperation());
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:22,代码来源:SOAPActionBasedDispatcherTest.java

示例5: processContentTypeForAction

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public static void processContentTypeForAction(String contentType, MessageContext msgContext) {
    //Check for action header and set it in as soapAction in MessageContext
    int index = contentType.indexOf("action");
    if (index > -1) {
        String transientString = contentType.substring(index, contentType.length());
        int equal = transientString.indexOf("=");
        int firstSemiColon = transientString.indexOf(";");
        String soapAction; // This will contain "" in the string
        if (firstSemiColon > -1) {
            soapAction = transientString.substring(equal + 1, firstSemiColon);
        } else {
            soapAction = transientString.substring(equal + 1, transientString.length());
        }
        if ((soapAction != null) && soapAction.startsWith("\"")
                && soapAction.endsWith("\"")) {
            soapAction = soapAction
                    .substring(1, soapAction.length() - 1);
        }
        msgContext.setSoapAction(soapAction);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:22,代码来源:TransportUtils.java

示例6: dispatchResponse

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * Dispatch the message to the target endpoint
 *
 * @param soapEnvelope   Soap Enevlop with message
 * @param responseAction WSE action for the response
 * @param mc             Message Context
 * @param isFault        Whether a Fault message must be sent
 * @throws AxisFault Thrown by the axis2 engine.
 */
private void dispatchResponse(SOAPEnvelope soapEnvelope, String responseAction,
                              MessageContext mc, boolean isFault) throws AxisFault {
    MessageContext rmc = MessageContextBuilder.createOutMessageContext(mc);
    rmc.getOperationContext().addMessageContext(rmc);
    replicateState(mc);
    rmc.setEnvelope(soapEnvelope);
    rmc.setWSAAction(responseAction);
    rmc.setSoapAction(responseAction);
    if (isFault) {
        AxisEngine.sendFault(rmc);
    } else {
        AxisEngine.send(rmc);
    }
}
 
开发者ID:wso2,项目名称:carbon-commons,代码行数:24,代码来源:PublishOnlyMessageReceiver.java

示例7: handleIncomingMessage

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * Process a new incoming message (Response) through the axis engine
 * @param msgCtx the axis MessageContext
 * @param trpHeaders the map containing transport level message headers
 * @param soapAction the optional soap action or null
 * @param contentType the optional content-type for the message
 */
public void handleIncomingMessage(
    MessageContext msgCtx, Map trpHeaders,
    String soapAction, String contentType) {

    // set the soapaction if one is available via a transport header
    if (soapAction != null) {
        msgCtx.setSoapAction(soapAction);
    }

    // set the transport headers to the message context
    msgCtx.setProperty(MessageContext.TRANSPORT_HEADERS, trpHeaders);
    
    // send the message context through the axis engine
    try {
            try {
                AxisEngine.receive(msgCtx);
            } catch (AxisFault e) {
                if (log.isDebugEnabled()) {
                    log.debug("Error receiving message", e);
                }
                if (msgCtx.isServerSide()) {
                    AxisEngine.sendFault(MessageContextBuilder.createFaultMessageContext(msgCtx, e));
                }
            }
    } catch (AxisFault axisFault) {
        logException("Error processing response message", axisFault);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2-transports,代码行数:36,代码来源:AbstractTransportSender.java

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

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

示例10: testDifferentSoapActionProcessing

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public void testDifferentSoapActionProcessing() throws Exception {
    String testfile = "valid-messages/" + versionDirectory + "/soapmessage.xml";
    MessageContext mc = new MessageContext();
    mc.setConfigurationContext(ConfigurationContextFactory.createEmptyConfigurationContext());
    mc.setServerSide(true);
    try {
        mc.setSoapAction("http://ws.apache.org/tests/differentAction");
        basicExtractAddressingInformationFromHeaders(testfile, mc);
        fail("An AxisFault should have been thrown due to the soapaction being different to the ws-a action.");
    }
    catch (AxisFault af) {
        //Test passed.
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:15,代码来源:AddressingFinalInHandlerTest.java

示例11: testEmptySoapAction

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public void testEmptySoapAction() throws Exception {
    String testfile = "valid-messages/" + versionDirectory + "/soapmessage.xml";
    MessageContext mc = new MessageContext();
    mc.setConfigurationContext(ConfigurationContextFactory.createEmptyConfigurationContext());
    try {
        mc.setSoapAction("");
        basicExtractAddressingInformationFromHeaders(testfile, mc);
    }
    catch (AxisFault af) {
        af.printStackTrace();
        log.error(af.getMessage());
        fail("An unexpected AxisFault was thrown while testing with an empty soapaction.");
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:15,代码来源:AddressingFinalInHandlerTest.java

示例12: testNullSoapAction

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public void testNullSoapAction() throws Exception {
    String testfile = "valid-messages/" + versionDirectory + "/soapmessage.xml";
    MessageContext mc = new MessageContext();
    mc.setConfigurationContext(ConfigurationContextFactory.createEmptyConfigurationContext());
    try {
        mc.setSoapAction(null);
        basicExtractAddressingInformationFromHeaders(testfile, mc);
    }
    catch (AxisFault af) {
        af.printStackTrace();
        log.error(af.getMessage());
        fail("An unexpected AxisFault was thrown while testing with a null soapaction.");
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:15,代码来源:AddressingFinalInHandlerTest.java

示例13: processHTTPGetRequest

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * @param msgContext           - The MessageContext of the Request Message
 * @param out                  - The output stream of the response
 * @param soapAction           - SoapAction of the request
 * @param requestURI           - The URL that the request came to
 * @param configurationContext - The Axis Configuration Context
 * @param requestParameters    - The parameters of the request message
 * @return - boolean indication whether the operation was succesfull
 * @throws AxisFault - Thrown in case a fault occurs
 * @deprecated use RESTUtil.processURLRequest(MessageContext msgContext, OutputStream out, String contentType) instead
 */

public static boolean processHTTPGetRequest(MessageContext msgContext,
                                            OutputStream out, String soapAction,
                                            String requestURI,
                                            ConfigurationContext configurationContext,
                                            Map requestParameters)
        throws AxisFault {
    if ((soapAction != null) && soapAction.startsWith("\"") && soapAction.endsWith("\"")) {
        soapAction = soapAction.substring(1, soapAction.length() - 1);
    }

    msgContext.setSoapAction(soapAction);
    msgContext.setTo(new EndpointReference(requestURI));
    msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
    msgContext.setServerSide(true);
    SOAPEnvelope envelope = HTTPTransportUtils.createEnvelopeFromGetRequest(requestURI,
                                                                            requestParameters,
                                                                            configurationContext);

    if (envelope == null) {
        return false;
    } else {
        msgContext.setDoingREST(true);
        msgContext.setEnvelope(envelope);
        AxisEngine.receive(msgContext);
        return true;
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:40,代码来源:HTTPTransportUtils.java

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

示例15: handleIncomingMessage

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * Process a new incoming message through the axis engine
 * @param msgCtx the axis MessageContext
 * @param trpHeaders the map containing transport level message headers
 * @param soapAction the optional soap action or null
 * @param contentType the optional content-type for the message
 */
public void handleIncomingMessage(
    MessageContext msgCtx, Map trpHeaders,
    String soapAction, String contentType) throws AxisFault {

    // set the soapaction if one is available via a transport header
    if (soapAction != null) {
        msgCtx.setSoapAction(soapAction);
    }

    // set the transport headers to the message context
    msgCtx.setProperty(MessageContext.TRANSPORT_HEADERS, trpHeaders);

    // send the message context through the axis engine
    try {
        // check if an Axis2 callback has been registered for this message
        Map callBackMap = (Map) msgCtx.getConfigurationContext().
            getProperty(BaseConstants.CALLBACK_TABLE);
        // FIXME: transport headers are protocol specific; the correlation ID should be
        // passed as argument to this method
        Object replyToMessageID = trpHeaders.get(BaseConstants.HEADER_IN_REPLY_TO);
        // if there is a callback registerd with this replyto ID then this has to
        // be handled as a synchronous incoming message, via the
        if (replyToMessageID != null && callBackMap != null &&
            callBackMap.get(replyToMessageID) != null) {

            SynchronousCallback synchronousCallback =
                (SynchronousCallback) callBackMap.get(replyToMessageID);
            synchronousCallback.setInMessageContext(msgCtx);
            callBackMap.remove(replyToMessageID);
        } else {
            AxisEngine.receive(msgCtx);
        }

    } catch (AxisFault e) {
        if (log.isDebugEnabled()) {
            log.debug("Error receiving message", e);
        }
        if (msgCtx.isServerSide()) {
            AxisEngine.sendFault(MessageContextBuilder.createFaultMessageContext(msgCtx, e));
        }
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2-transports,代码行数:50,代码来源:AbstractTransportListener.java


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