【问题标题】:How to get real result from AxisEngine如何从 AxisEngine 获得真实结果
【发布时间】:2014-04-16 06:09:04
【问题描述】:

我正在尝试基于一些专有的二进制协议为 WSO2 ESB 实现我的特定传输。根据协议规范,只有当我 100% 确定将来会处理它时,我才需要确认我收到的每个数据包。由于这些原因,必须使用一些持久性存储。

我想通过 WSO2 ESB 序列实现该协议逻辑,该序列获取协议数据包/消息并将它们存储到临时messageStore,它用作生产者/消费者模式中的队列(其中生产者是传输本身,消费者是我的数据包处理器)。

在向客户端发送确认之前,我必须确保我的数据包到达了messageStore。但即使消息存储不可用,AxisEngine.receive() 也总是返回 CONTINUE。

代理的配置是:

<proxy name="MyProxyService">
    <target>
        <inSequence>
            <store messageStore="MyStore" sequence="onStoreSequence"/>
        </inSequence>
        <outSequence>
            <send/>
        </outSequence>
        <faultSequence>
            <makefault version="soap11" response="true">
                <code xmlns:tns="http://www.w3.org/2003/05/soap-envelope" value="tns:Receiver"/>
                <reason expression="get-property('ERROR_MESSAGE')"/>
            </makefault>
            <send/>
        </faultSequence>
    </target>
</proxy>

我在传输中使用的代码是:

MessageContext msgContext = confContext.createMessageContext();
AxisConfiguration axisConf = confContext.getAxisConfiguration();
try {
   msgContext.setTransportIn(axisConf.getTransportIn(transportName));
   msgContext.setTransportOut(axisConf.getTransportOut(transportName));
   msgContext.setIncomingTransportName(Constants.TRANSPORT_LOCAL);
   msgContext.setAxisService(axisConf.getService("MyProxyService"));
   msgContext.setEnvelope(TransportUtils.createSOAPMessage(msgContext));
   msgContext.setServerSide(true);
   Handler.InvocationResponse response = AxisEngine.receive(msgContext);
   log.error(String.valueOf(response));
} catch (Exception e) {
   log.error("ERROR", e);
}

我想要的行为是我在 HTTP 传输中看到的:来自客户端 (SOAP UI) 的 http 请求被转换为 Axis2 MessageContext 并传递给 MyProxyService。如果一切正常 - 我会得到肯定的响应,否则 - 错误代码和 SOAP 错误。

【问题讨论】:

    标签: axis2 wso2esb synapse


    【解决方案1】:

    经过进一步调查,我可以说 HTTP 传输请求/响应背后的想法是,使用 HttpSender 而不是 HttpReceiver 发送响应。 HttpReceiver 从 HTTP 连接获取请求,设置指向消息上下文的 HTTP 连接的链接,使用 AxisEngine.receive() 将消息传递到 ESB 并返回。

    HTTP 响应本身通过HttpSender 接收,标识为对前一个请求的响应(通过空 To 标头)并发送到消息上下文引用的连接。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-01-13
      • 2014-08-30
      • 2020-03-03
      • 1970-01-01
      • 1970-01-01
      • 2013-03-28
      • 2017-08-18
      相关资源
      最近更新 更多