我想做的事:Spring集成处理程序错误 - >确认 - 确认通道
- 从Web服务接收消息
- 发送XML消息兔
- 验证XML为xsd - >启动异常(验证不正确的)
- 返回定制错误消息发送到web服务
步骤1:接收从web服务消息 - > RESULT行
<ws:inbound-gateway id="ws-inbound-gateway"
request-channel="requestChannel" reply-channel="replyChannel" reply-timeout="300000"
error-channel="errorChannel" />
<int:chain input-channel="requestChannel" output-channel="inbound">
<int:service-activator ref="defaultLogger" method="logger"/>
</int:chain>
步骤2:写扇出交换兔一个XML消息 - > RESULT行
<int-amqp:outbound-channel-adapter
channel="inbound" amqp-template="amqpTemplate" return-channel="outbound"
exchange-name="es.queue.test"
confirm-ack-channel="confirmAck" confirm-nack-channel="confirmNack" confirm-correlation-expression="#this" />
步骤3:验证XML为xsd - >结果确定XsdValidationException
<int:chain input-channel="confirmAck" output-channel="outbound">
<int:service-activator ref="defaultLogger" method="logger"/>
<int-xml:validating-filter schema-type="xml-schema"
schema-location="classpath:/schema/prueba.xsd"
throw-exception-on-rejection="true" discard-channel="errorChannel" />
</int:chain>
在这一步的消息将被发送到errorChannel,但我有一个错误:
63863 [AMQP Connection 10.0.9.155:5672] ERROR o.s.a.r.s.PublisherCallbackChannelImpl - Exception delivering confirm
org.springframework.integration.MessageRejectedException: Message was rejected due to XML Validation errors; nested exception is org.springframework.integration.xml.AggregatedXmlMessageValidationException: Multiple causes:
cvc-elt.1: No se ha encontrado la declaración del elemento 'ns2:***'.
at org.springframework.integration.xml.selector.XmlValidatingMessageSelector.accept(XmlValidatingMessageSelector.java:134)
at org.springframework.integration.filter.MessageFilter.doHandleRequestMessage(MessageFilter.java:161)
at org.springframework.integration.handler.AbstractReplyProducingPostProcessingMessageHandler.handleRequestMessage(AbstractReplyProducingPostProcessingMessageHandler.java:46)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:109)
步骤4:Web服务客户端永远不会收到响应 我认为它发生错误“异常发送确认”,因为当尝试发送确认应答时异常抛出线程AMQP。
你能帮我吗?