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


Java MessageContext.getTransportOut方法代码示例

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


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

示例1: resumeSend

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * To resume the invocation at the send path , this is neened since it is require to call
 * TransportSender at the end
 *
 * @param msgContext
 * @return An InvocationResponse allowing the invoker to perhaps determine
 *         whether or not the message processing will ever succeed.
 * @throws AxisFault
 */
public static InvocationResponse resumeSend(MessageContext msgContext) throws AxisFault {
    if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
        log.trace(msgContext.getLogIDString() + " resumeSend:" + msgContext.getMessageID());
    }

    //REVIEW: This name is a little misleading, as it seems to indicate that there should be a resumeSendFault as well, when, in fact, this does both
    //REVIEW: Unlike with send, there is no wrapping try/catch clause which would
    //fire off the flowComplete on an error, as we have to assume that the
    //message will be resumed again, but perhaps we need to unwind back to
    //the point at which the message was resumed and provide another API
    //to allow the full unwind if the message is going to be discarded.
    //invoke the phases
    InvocationResponse pi = invoke(msgContext, RESUMING_EXECUTION);
    //Invoking Transport Sender
    if (pi.equals(InvocationResponse.CONTINUE)) {
        // write the Message to the Wire
        TransportOutDescription transportOut = msgContext.getTransportOut();
        TransportSender sender = transportOut.getSender();
        sender.invoke(msgContext);
        flowComplete(msgContext);
    }

    return pi;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:34,代码来源:AxisEngine.java

示例2: setupCorrectTransportOut

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * Ensure that if the scheme of the To EPR for the response is different than the
 * transport used for the request that the correct TransportOut is available
 */
private static void setupCorrectTransportOut(MessageContext context) throws AxisFault {
    // Determine that we have the correct transport available.
    TransportOutDescription transportOut = context.getTransportOut();

    try {
        EndpointReference responseEPR = context.getTo();
        if (context.isServerSide() && responseEPR != null) {
            if (!responseEPR.hasAnonymousAddress() && !responseEPR.hasNoneAddress()) {
                URI uri = new URI(responseEPR.getAddress());
                String scheme = uri.getScheme();
                if ((transportOut == null) || !transportOut.getName().equals(scheme)) {
                    ConfigurationContext configurationContext =
                            context.getConfigurationContext();
                    transportOut = configurationContext.getAxisConfiguration()
                            .getTransportOut(scheme);
                    if (transportOut == null) {
                        throw new AxisFault("Can not find the transport sender : " + scheme);
                    }
                    context.setTransportOut(transportOut);
                }
                if (context.getOperationContext() != null) {
                    context.getOperationContext().setProperty(
                            Constants.DIFFERENT_EPR, Constants.VALUE_TRUE);
                }
            }
        }
    } catch (URISyntaxException urise) {
        throw AxisFault.makeFault(urise);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:35,代码来源:MessageContextBuilder.java

示例3: send

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * This methods represents the outflow of the Axis, this could be either at the server side or the client side.
 * Here the <code>ExecutionChain</code> is created using the Phases. The Handlers at the each Phases is ordered in
 * deployment time by the deployment module
 *
 * @param msgContext
 * @throws AxisFault
 * @see MessageContext
 * @see Phase
 * @see Handler
 */
public static void send(MessageContext msgContext) throws AxisFault {
    if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
        log.trace(msgContext.getLogIDString() + " send:" + msgContext.getMessageID());
    }
    // find and invoke the Phases
    OperationContext operationContext = msgContext.getOperationContext();
    ArrayList executionChain = operationContext.getAxisOperation().getPhasesOutFlow();
    //rather than having two steps added both oparation and global chain together
    ArrayList outPhases = new ArrayList();
    outPhases.addAll(executionChain);
    outPhases.addAll(msgContext.getConfigurationContext().getAxisConfiguration().getOutFlowPhases());
    msgContext.setExecutionChain(outPhases);
    msgContext.setFLOW(MessageContext.OUT_FLOW);
    try {
        InvocationResponse pi = invoke(msgContext, NOT_RESUMING_EXECUTION);

        if (pi.equals(InvocationResponse.CONTINUE)) {
            // write the Message to the Wire
            TransportOutDescription transportOut = msgContext.getTransportOut();
            if (transportOut == null) {
                throw new AxisFault("Transport out has not been set");
            }
            TransportSender sender = transportOut.getSender();
            // This boolean property only used in client side fireAndForget invocation
            //It will set a property into message context and if some one has set the
            //property then transport sender will invoke in a diffrent thread
            if (Utils.isClientThreadNonBlockingPropertySet(msgContext)) {
                msgContext.getConfigurationContext().getThreadPool().execute(
                        new TransportNonBlockingInvocationWorker(msgContext, sender));
            } else {
                sender.invoke(msgContext);
            }
            //REVIEW: In the case of the TransportNonBlockingInvocationWorker, does this need to wait until that finishes?
            flowComplete(msgContext);
        } else if (pi.equals(InvocationResponse.SUSPEND)) {
        } else if (pi.equals(InvocationResponse.ABORT)) {
            flowComplete(msgContext);
        } else {
            String errorMsg =
                    "Unrecognized InvocationResponse encountered in AxisEngine.send()";
            log.error(msgContext.getLogIDString() + " " + errorMsg);
            throw new AxisFault(errorMsg);
        }
    } catch (AxisFault e) {
        msgContext.setFailureReason(e);
        flowComplete(msgContext);
        throw e;
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:61,代码来源:AxisEngine.java

示例4: inferInTransport

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public static TransportInDescription inferInTransport(AxisConfiguration ac,
                                                                   Options options,
                                                                   MessageContext msgCtxt)
        throws AxisFault {
    String listenerTransportProtocol = options.getTransportInProtocol();
    if (listenerTransportProtocol == null) {
        EndpointReference replyTo = msgCtxt.getReplyTo();
        if (replyTo != null) {
            try {
                URI uri = new URI(replyTo.getAddress());
                listenerTransportProtocol = uri.getScheme();
            } catch (URISyntaxException e) {
                //need to ignore
            }
        } else {
            //assume listener transport as sender transport
            if (msgCtxt.getTransportOut() != null) {
                listenerTransportProtocol = msgCtxt.getTransportOut().getName();
            }
        }
    }
    TransportInDescription transportIn = null;
    if (options.isUseSeparateListener() || msgCtxt.getOptions().isUseSeparateListener()) {
        if ((listenerTransportProtocol != null) && !"".equals(listenerTransportProtocol)) {
            transportIn = ac.getTransportIn(listenerTransportProtocol);
            ListenerManager listenerManager =
                    msgCtxt.getConfigurationContext().getListenerManager();
            if (transportIn == null) {
                // TODO : User should not be mandated to give an IN transport. If it is not given, we should
                // ask from the ListenerManager to give any available transport for this client.
                log.error(Messages.getMessage("unknownTransport",
                                                        listenerTransportProtocol));
                throw new AxisFault(Messages.getMessage("unknownTransport",
                                                        listenerTransportProtocol));
            }
            synchronized (ClientUtils.class) {
                if (!listenerManager.isListenerRunning(transportIn.getName())) {
                    listenerManager.addListener(transportIn, false);
                }
            }
        }
        if (msgCtxt.getAxisService() != null) {
            if (!msgCtxt.isEngaged(Constants.MODULE_ADDRESSING)) {
                log.error(Messages.getMessage("2channelNeedAddressing"));
                throw new AxisFault(Messages.getMessage("2channelNeedAddressing"));
            }
        } else {
            if (!ac.isEngaged(Constants.MODULE_ADDRESSING)) {
                log.error(Messages.getMessage("2channelNeedAddressing"));
                throw new AxisFault(Messages.getMessage("2channelNeedAddressing"));
            }
        }
    }

    return transportIn;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:57,代码来源:ClientUtils.java

示例5: cleanupTransport

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * Release resources allocated by the transport during the last service invocation.
 * This method will call
 * {@link org.apache.axis2.transport.TransportSender#cleanup(MessageContext)} on the
 * transport sender used during that invocation.
 * <p>
 * If the <code>callTransportCleanup</code> property on the {@link Options} object is
 * set to <code>false</code> (which is the default), then this method must be called
 * after each invocation of an operation with an in-out MEP, but not before the response
 * from that operation has been completely processed (or {@link OMElement#build()}
 * has been called on the response element).
 * <p>
 * If the <code>callTransportCleanup</code> property is set to <code>true</code>,
 * then this method is called automatically. Note that in this case, {@link OMElement#build()}
 * will be called on the response element before is returned. This effectively disables
 * deferred parsing of the response and prevents the code from starting to process the
 * response before it has been completely received. Therefore this approach is not recommended
 * whenever performance is important.
 *
 * @throws AxisFault
 */
public void cleanupTransport() throws AxisFault {
    final OperationContext lastOperationContext = getLastOperationContext();
    if (lastOperationContext != null) {
        MessageContext outMessageContext =
                lastOperationContext
                        .getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
        if (outMessageContext != null) {
            if (outMessageContext.getTransportOut() != null &&
                    outMessageContext.getTransportOut().getSender() != null) {
                outMessageContext.getTransportOut().getSender().cleanup(outMessageContext);
            }
        }
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:36,代码来源:ServiceClient.java

示例6: complete

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * To close the transport if necessary , can call this method. The main
 * usage of this method is when client uses two tarnsports for sending and
 * receiving , and we need to remove entries for waiting calls in the
 * transport listener queue.
 * Note : DO NOT call this method if you are not using two transports to
 * send and receive
 *
 * @param msgCtxt : MessageContext# which has all the transport information
 * @throws AxisFault : throws AxisFault if something goes wrong
 */
public void complete(MessageContext msgCtxt) throws AxisFault {
    TransportOutDescription trsout = msgCtxt.getTransportOut();
    if (trsout != null) {
        trsout.getSender().cleanup(msgCtxt);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:18,代码来源:OperationClient.java


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