【发布时间】: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 错误。
【问题讨论】: