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


Java MessageContext.setAxisOperation方法代码示例

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


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

示例1: dispatchAndVerify

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * Finds axis Service and the Operation for DSS requests
 *
 * @param msgContext request message context
 * @throws AxisFault if any exception occurs while finding axis service or operation
 */
private static void dispatchAndVerify(MessageContext msgContext) throws AxisFault {
    requestDispatcher.invoke(msgContext);
    AxisService axisService = msgContext.getAxisService();
    if (axisService != null) {
        httpLocationBasedDispatcher.invoke(msgContext);
        if (msgContext.getAxisOperation() == null) {
            requestURIOperationDispatcher.invoke(msgContext);
        }

        AxisOperation axisOperation;
        if ((axisOperation = msgContext.getAxisOperation()) != null) {
            AxisEndpoint axisEndpoint =
                    (AxisEndpoint) msgContext.getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME);
            if (axisEndpoint != null) {
                AxisBindingOperation axisBindingOperation = (AxisBindingOperation) axisEndpoint
                        .getBinding().getChild(axisOperation.getName());
                msgContext.setProperty(Constants.AXIS_BINDING_OPERATION, axisBindingOperation);
            }
            msgContext.setAxisOperation(axisOperation);
        }
    }
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:29,代码来源:IntegratorStatefulHandler.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: testMessageWithOmittedMessageIDInOutMEP

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public void testMessageWithOmittedMessageIDInOutMEP() throws Exception {
    MessageContext messageContext = testMessageWithOmittedHeaders("noMessageID");
    String messageID = messageContext.getOptions().getMessageId();

    assertNull("The message id is not null.", messageID);

    AxisOperation axisOperation = new InOutAxisOperation();
    messageContext.setAxisOperation(axisOperation);
    AxisService axisService = new AxisService();
    messageContext.setAxisService(axisService);

    try {
        validationHandler.invoke(messageContext);
        fail("An AxisFault should have been thrown due to the absence of a message id.");
    }
    catch (AxisFault af) {
        //Test passed.
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:20,代码来源:AddressingValidationHandlerTest.java

示例4: testInOutMessageWithOmittedMessageID

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public void testInOutMessageWithOmittedMessageID() throws Exception {
    MessageContext messageContext = testMessageWithOmittedHeaders("noMessageID");
    String messageID = messageContext.getOptions().getMessageId();

    assertNull("The message id is not null.", messageID);

    AxisOperation axisOperation = new InOutAxisOperation();
    messageContext.setAxisOperation(axisOperation);
    AxisService axisService = new AxisService();
    messageContext.setAxisService(axisService);

    try {
        validationHandler.invoke(messageContext);
    } catch (AxisFault axisFault) {
        // Confirm this is the correct fault
        assertEquals("Wrong fault code",
                     new QName(Final.WSA_NAMESPACE,
                               Final.FAULT_ADDRESSING_HEADER_REQUIRED),
                     axisFault.getFaultCode());
        return;
    }
    fail("Validated message with missing message ID!");
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:24,代码来源:AddressingValidationHandlerTest.java

示例5: invoke

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * @param msgctx
 * @throws org.apache.axis2.AxisFault
 */
public InvocationResponse invoke(MessageContext msgctx) throws AxisFault {
    if ((msgctx.getAxisService() != null) && (msgctx.getAxisOperation() == null)) {
        AxisOperation axisOperation = findOperation(msgctx.getAxisService(), msgctx);

        if (axisOperation != null) {
            if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
                log.debug(msgctx.getLogIDString() + " " + Messages.getMessage("operationfound",
                                                                              axisOperation
                                                                                      .getName().getLocalPart()));
            }

            msgctx.setAxisOperation(axisOperation);
            //setting axisMessage into messageContext
            msgctx.setAxisMessage(axisOperation.getMessage(
                    WSDLConstants.MESSAGE_LABEL_IN_VALUE));
        }
    }
    return InvocationResponse.CONTINUE;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:24,代码来源:AbstractOperationDispatcher.java

示例6: setSynapseContext

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
private void setSynapseContext(MessageContext messageContext, AxisService originalAxisService) throws AxisFault {
    AxisService axisService = synapseDispatcher.findService(messageContext);
    if (log.isDebugEnabled()) {
        log.debug("AxisService is changing from " + originalAxisService.getName() + " to " +
                axisService.getName());
    }
    messageContext.setAxisService(axisService);
    messageContext.setAxisOperation(synapseDispatcher.findOperation(messageContext.getAxisService(),
            messageContext));
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:11,代码来源:IntegratorStatefulHandler.java

示例7: testEchoXMLSyncMC

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public void testEchoXMLSyncMC() throws Exception {        
    AxisOperation opdesc = new OutInAxisOperation(new QName("echoOMElement"));
    Options options = new Options();
    options.setTo(targetEPR);
    options.setAction(operationName.getLocalPart());
    options.setTransportInProtocol(Constants.TRANSPORT_TCP);

    OMFactory fac = OMAbstractFactory.getOMFactory();

    OMNamespace omNs = fac.createOMNamespace("http://localhost/my", "my");
    OMElement method = fac.createOMElement("echoOMElement", omNs);
    OMElement value = fac.createOMElement("myValue", omNs);
    value.setText("Isaac Asimov, The Foundation Trilogy");
    method.addChild(value);
    SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
    SOAPEnvelope envelope = factory.getDefaultEnvelope();
    envelope.getBody().addChild(method);

    MessageContext requestContext = new MessageContext();
    requestContext.setConfigurationContext(configContext);
    requestContext.setAxisService(clientService);
    requestContext.setAxisOperation(opdesc);
    requestContext.setEnvelope(envelope);

    ServiceClient sender = new ServiceClient(configContext, clientService);
    sender.setOptions(options);
    OperationClient opClient = sender.createClient(new QName("echoOMElement"));
    opClient.addMessageContext(requestContext);
    opClient.setOptions(options);
    opClient.execute(true);

    MessageContext response = opClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
    SOAPEnvelope env = response.getEnvelope();
    assertNotNull(env);
    env.getBody().serialize(StAXUtils.createXMLStreamWriter(
            System.out));
    sender.cleanup();
}
 
开发者ID:wso2,项目名称:wso2-axis2-transports,代码行数:39,代码来源:TCPEchoRawXMLTest.java

示例8: setUp

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    messageContext = new MessageContext();
    axisConfiguration = new AxisConfiguration();
    configurationContext = new ConfigurationContext(axisConfiguration);
    axisService = new AxisService("Dummy Service");
    message = new AxisMessage();
    axisOperation = AxisOperationFactory.getAxisOperation(WSDLConstants.MEP_CONSTANT_IN_OUT);
    jsonMessageHandler = new JSONMessageHandler();


    String fileName = "test-resources/custom_schema/testSchema_2.xsd";
    InputStream is = new FileInputStream(fileName);
    XmlSchemaCollection schemaCol = new XmlSchemaCollection();
    XmlSchema schema = schemaCol.read(new StreamSource(is), null);


    QName elementQName = new QName("http://test.json.axis2.apache.org" ,"echoPerson");
    message.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_IN);
    message.setElementQName(elementQName);
    message.setParent(axisOperation);
    axisOperation.addMessage(message, WSDLConstants.MESSAGE_LABEL_IN_VALUE);

    axisService.addSchema(schema);
    axisService.addOperation(axisOperation);

    SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory();
    SOAPEnvelope soapEnvelope = soapFactory.getDefaultEnvelope();

    messageContext.setConfigurationContext(configurationContext);
    messageContext.setAxisService(axisService);
    messageContext.setAxisOperation(axisOperation);
    messageContext.setEnvelope(soapEnvelope);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:35,代码来源:JSONMessageHandlerTest.java

示例9: testMessageWithOmittedMessageIDInOnlyMEP

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public void testMessageWithOmittedMessageIDInOnlyMEP() throws Exception {
    MessageContext messageContext = testMessageWithOmittedHeaders("noMessageID");
    String messageID = messageContext.getOptions().getMessageId();

    assertNull("The message id is not null.", messageID);

    AxisOperation axisOperation = new InOnlyAxisOperation();
    messageContext.setAxisOperation(axisOperation);
    AxisService axisService = new AxisService();
    messageContext.setAxisService(axisService);
    validationHandler.invoke(messageContext);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:13,代码来源:AddressingValidationHandlerTest.java

示例10: testMessageWithMessageIDInOutMEP

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public void testMessageWithMessageIDInOutMEP() throws Exception {
    MessageContext messageContext = testMessageWithOmittedHeaders("noFrom");
    String messageID = messageContext.getOptions().getMessageId();

    assertNotNull("The message id is null.", messageID);

    AxisOperation axisOperation = new InOutAxisOperation();
    messageContext.setAxisOperation(axisOperation);
    AxisService axisService = new AxisService();
    messageContext.setAxisService(axisService);
    validationHandler.invoke(messageContext);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:13,代码来源:AddressingValidationHandlerTest.java

示例11: invoke

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
    AxisOperation op = msgContext.getAxisOperation();       
    if (!msgContext.isServerSide() && op != null && isAnonymousOperation(op)) {
        op = findRealOperationAction(msgContext);         
        if (op != null) {
            msgContext.setAxisOperation(op);
            if (LOG.isDebugEnabled()) {
                LOG.debug("Anonymous operation detected. Replaced with real operation: " + op);
            }
        }
    }                
    return InvocationResponse.CONTINUE;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:14,代码来源:DispatchOperationHandler.java

示例12: dispatchAndVerify

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
private static void dispatchAndVerify(MessageContext msgContext) throws AxisFault {
    RequestURIBasedDispatcher requestDispatcher = new RequestURIBasedDispatcher();
    requestDispatcher.invoke(msgContext);
    AxisService axisService = msgContext.getAxisService();
    if (axisService != null) {
        HTTPLocationBasedDispatcher httpLocationBasedDispatcher =
                new HTTPLocationBasedDispatcher();
        httpLocationBasedDispatcher.invoke(msgContext);
        if (msgContext.getAxisOperation() == null) {
            RequestURIOperationDispatcher requestURIOperationDispatcher =
                    new RequestURIOperationDispatcher();
            requestURIOperationDispatcher.invoke(msgContext);
        }

        AxisOperation axisOperation;
        if ((axisOperation = msgContext.getAxisOperation()) != null) {
            AxisEndpoint axisEndpoint =
                    (AxisEndpoint) msgContext.getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME);
            if (axisEndpoint != null) {
                AxisBindingOperation axisBindingOperation = (AxisBindingOperation) axisEndpoint
                        .getBinding().getChild(axisOperation.getName());
                msgContext.setProperty(Constants.AXIS_BINDING_OPERATION, axisBindingOperation);
            }
            msgContext.setAxisOperation(axisOperation);
        }
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:28,代码来源:RESTUtil.java

示例13: registerOperationContext

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public void registerOperationContext(MessageContext msgContext,
                                     OperationContext operationContext)
        throws AxisFault {
    msgContext.setAxisOperation(this);
    msgContext.getConfigurationContext().registerOperationContext(msgContext.getMessageID(),
                                                                  operationContext);
    operationContext.addMessageContext(msgContext);
    msgContext.setOperationContext(operationContext);
    if (operationContext.isComplete()) {
        operationContext.cleanup();
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:13,代码来源:AxisOperation.java

示例14: registerMessageContext

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public void registerMessageContext(MessageContext msgContext,
                                   OperationContext operationContext) throws AxisFault {
    msgContext.setAxisOperation(this);
    operationContext.addMessageContext(msgContext);
    msgContext.setOperationContext(operationContext);
    if (operationContext.isComplete()) {
        operationContext.cleanup();
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:10,代码来源:AxisOperation.java

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


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