我已经定义了“验证”介体故障序列。如果我的验证失败,我想要那个。消息应该发送回客户端以及基于JMS的队列。
问题:
克隆调解员无法正常工作。我使用clone mediator将消息发送到队列,然后“Respond”mediator将消息发送回客户端。
注意: 如果我删除了克隆介体,则该消息将完美地发送回客户端。但是使用clone mediator它不起作用。
验证调解员代码:
<validate>
<schema xmlns:ns2="http://org.apache.synapse/xsd" xmlns:ns="http://org.apache.synapse/xsd" key="gov:/xsd/testschema.xsd"></schema>
<on-fail>
<makefault version="soap11">
<detail xmlns:ns2="http://org.apache.synapse/xsd" xmlns:ns="http://org.apache.synapse/xsd" expression="get-property('ERROR_DETAIL')"></detail>
</makefault>
<payloadFactory media-type="xml">
<format>
<ErrorMessage xmlns="">
<ErrorCode>007</ErrorCode>
<ErrorMessage>Not Correct Request</ErrorMessage>
</ErrorMessage>
</format>
</payloadFactory>
<clone continueParent="true" sequential="false">
<target>
<endpoint>
<address uri="jms:/ErrorQueue?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616&transport.jms.DestinationType=queue"></address>
</endpoint>
</target>
</clone>
<respond></respond>
</on-fail>
</validate>
例外:
未捕获的异常{org.apache.axis2.transport.base.threads.NativeWorkerPool} java.lang.ClassCastException:org.apache.axiom.om.impl.llom.OMElementImpl无法强制转换为org.apache.axiom.soap.SOAPFault 在org.apache.axiom.soap.impl.llom.SOAPBodyImpl.getFault(SOAPBodyImpl.java:120) at org.apache.synapse.util.MessageHelper.cloneSOAPEnvelope(MessageHelper.java:383) at org.apache.synapse.util.MessageHelper.cloneAxis2MessageContext(MessageHelper.java:233) at org.apache.synapse.util.MessageHelper.cloneMessageContext(MessageHelper.java:86) at org.apache.synapse.mediators.eip.splitter.CloneMediator.getClonedMessageContext(CloneMediator.java:159) 在org.apache.synapse.mediators.eip.splitter.CloneMediator.mediate(CloneMediator.java:99) 在org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77) 在org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47) 在org.apache.synapse.mediators.builtin.ValidateMediator.mediate(ValidateMediator.java:212) 在org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77) 在org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47) 在org.apache.synapse.mediators.template.TemplateMediator.mediate(TemplateMediator.java:77) 在org.apache.synapse.mediators.template.InvokeMediator.mediate(InvokeMediator.java:129) 在org.apache.synapse.mediators.template.InvokeMediator.mediate(InvokeMediator.java:78) 在org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77) 在org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47) 在org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131) at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:196) 在org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77) 在org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47) 在org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131) at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:166) 在org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) 在org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:411) 在org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:183) 在org.apache.axis2.transport.base.threads.NativeWorkerPool $ 1.run(NativeWorkerPool.java:172) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:615)
注意: 我也没有在“Clone”中介的“SOAP Action”字段中定义任何内容。
答案 0 :(得分:1)
这是ESB 4.8.1中的错误。请检查[1]
1。https://wso2.org/jira/browse/ESBJAVA-3087
尝试使用call mediator并丰富mediator。我没有测试过这个。
<validate>
<schema xmlns:ns2="http://org.apache.synapse/xsd" xmlns:ns="http://org.apache.synapse/xsd" key="gov:/xsd/testschema.xsd"></schema>
<on-fail>
<makefault version="soap11">
<detail xmlns:ns2="http://org.apache.synapse/xsd" xmlns:ns="http://org.apache.synapse/xsd" expression="get-property('ERROR_DETAIL')"></detail>
</makefault>
<payloadFactory media-type="xml">
<format>
<ErrorMessage xmlns="">
<ErrorCode>007</ErrorCode>
<ErrorMessage>Not Correct Request</ErrorMessage>
</ErrorMessage>
</format>
</payloadFactory>
**<property name="BODY_ELEMENTS" expression="$body">**
**<call>**
<endpoint>
<address uri="jms:/ErrorQueue?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616&transport.jms.DestinationType=queue"></address>
</endpoint>
**</call>**
**<enrich>
<source xpath="$ctx:BODY_ELEMENTS/>
<target type="body"/>
</enrich>**
<respond></respond>
</on-fail>
</validate>