Hi,
Following confiuration throws below error after sending an object to in channel:
Code:<si:channel id="in"/> <si:channel id="out"/> <si:channel id="marshal"/> <stream:stdout-channel-adapter id="stdout" channel="out" append-newline="true" /> <si-xml:marshalling-transformer marshaller="castorMarshaller" input-channel="in" output-channel="marshal" result-type="StringResult"/> <si-xml:xpath-splitter input-channel="marshal" output-channel="out"> <si-xml:xpath-expression expression="/employee/location"/> </si-xml:xpath-splitter>Even though marshal chanel contains String message, error says: The XPathMessageSplitter only accepts [org.w3c.dom.Node] or [java.lang.String] typed payloads.Code:Exception in thread "main" org.springframework.integration.core.MessagingException: failed to split Message payload at org.springframework.integration.xml.splitter.XPathMessageSplitter.splitMessage(XPathMessageSplitter.java:120) at org.springframework.integration.splitter.AbstractMessageSplitter.handleRequestMessage(AbstractMessageSplitter.java:36) at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:91) at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:59) at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:103) at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:90) at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:43) at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:116) at org.springframework.integration.channel.MessageChannelTemplate.doSend(MessageChannelTemplate.java:223) at org.springframework.integration.channel.MessageChannelTemplate.send(MessageChannelTemplate.java:181) at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.sendReplyMessage(AbstractReplyProducingMessageHandler.java:119) at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:107) at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:59) at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:103) at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:90) at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:43) at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:116) at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:94) at si.SI.main(SI.java:32) Caused by: java.lang.IllegalArgumentException: Unsupported payload type [org.springframework.xml.transform.StringResult]. The XPathMessageSplitter only accepts [org.w3c.dom.Node] or [java.lang.String] typed payloads. at org.springframework.integration.xml.splitter.XPathMessageSplitter.splitMessage(XPathMessageSplitter.java:109) ... 18 more
The splitter works correctly if a xml string is passed directly to in channel. e.g.
Marshaller also works correctly and produces valid XML.Code:"<?xml version=\"1.0\" encoding=\"UTF-8\"?><employee><name>K.D.</name><location><city>?</city></location></employee>"


Reply With Quote