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


Java MessageContext.setAxisMessage方法代码示例

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


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

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

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

示例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(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

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

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

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

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

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

示例10: invoke

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
     * @param msgctx
     * @throws org.apache.axis2.AxisFault
     * @noinspection MethodReturnOfConcreteClass
     */
    public InvocationResponse invoke(MessageContext msgctx) throws AxisFault {
        InvocationResponse response = InvocationResponse.CONTINUE;
        
        // first check we can dispatch using the relates to
        if (msgctx.getRelatesTo() != null) {
            String relatesTo = msgctx.getRelatesTo().getValue();

            if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
                log.debug(msgctx.getLogIDString() + " " + Messages.getMessage("checkingrelatesto",
                                                                              relatesTo));
            }
            if (relatesTo != null && !"".equals(relatesTo) && (msgctx.getOperationContext()==null)) {
                OperationContext operationContext =
                        msgctx.getConfigurationContext()
                                .getOperationContext(relatesTo);

                if (operationContext != null) //noinspection TodoComment
                {
//                    if(operationContext.isComplete()){
//                        // If the dispatch happens because of the RelatesTo and the mep is complete
//                        // we should throw a more descriptive fault.
//                        throw new AxisFault(Messages.getMessage("duplicaterelatesto",relatesTo));
//                    }
                    msgctx.setAxisOperation(operationContext.getAxisOperation());
                    msgctx.setAxisMessage(operationContext.getAxisOperation().getMessage(
                                                                WSDLConstants.MESSAGE_LABEL_IN_VALUE));
                    msgctx.setOperationContext(operationContext);
                    msgctx.setServiceContext((ServiceContext) operationContext.getParent());
                    msgctx.setAxisService(
                            ((ServiceContext) operationContext.getParent()).getAxisService());

                    // TODO : Is this necessary here?
                    msgctx.getAxisOperation().registerMessageContext(msgctx, operationContext);

                    msgctx.setServiceGroupContextId(
                            ((ServiceGroupContext) msgctx.getServiceContext().getParent()).getId());

                    if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
                        log.debug(msgctx.getLogIDString() +
                                " Dispatched successfully on the RelatesTo. operation=" +
                                operationContext.getAxisOperation());
                    }
                }
            }
        }
        //Else we will try to dispatch based on the WS-A Action
        else {
            response = super.invoke(msgctx);
            Object flag = msgctx.getLocalProperty(IS_ADDR_INFO_ALREADY_PROCESSED);
            if (log.isTraceEnabled()) {
                log.trace("invoke: IS_ADDR_INFO_ALREADY_PROCESSED=" + flag);
            }

            if (JavaUtils.isTrueExplicitly(flag)) {
                // If no AxisOperation has been found at the end of the dispatch phase and addressing
                // is in use we should throw an ActionNotSupported Fault, unless we've been told
                // not to do this check (by Synapse, for instance)
                if (JavaUtils.isTrue(msgctx.getProperty(ADDR_VALIDATE_ACTION), true)) {
                    checkAction(msgctx);
                }
            }
        }
        
        return response;
    }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:71,代码来源:AddressingBasedDispatcher.java


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