Hi all. I'm attempting to create a Spring Integration flow involving an xpath-header-enricher and an xslt-transformer. The transformer works fine on its own, as does the header enricher. However, once I follow the header enricher with the transformer, I get a "failed to transform"/"content is not allowed in prolog" error.
That error is usually indicative of malformed XML somewhere or an encoding issue, but when the transformation works perfectly on its own, I can't possibly imagine that a header enricher would affect the payload (which is a Document) at all, let alone to the point where it would break it.
This leads me to believe that using the xpath-header-enricher introduces a parser which doesn't play nice with the transformer. I have Saxon as a dependency so I can use XSLT 2.0. I looked into the hierarchy and saw that Jaxen is an optional dependency to spring-xml (the WS version), but including it in my project didn't change anything.
Any ideas? Here's my configuration:
I have wiretaps on my channels so I can see that my message is definitely passing through the flow, as it gets the correct headers/payload based on the other components.Code:<int:gateway service-interface="com.domain.framework.event.gateway.EventGateway" id="eventGateway" default-request-channel="eventRouteAccessChainChannel" default-reply-channel="eventGatewayOutputChannel" /> <int-xml:xpath-expression id="eventTypeExp" expression="/emit:event/@eventType" namespace-map="namespaceMap" /> <int:chain input-channel="eventRouteAccessChainChannel"> <int-xml:validating-filter schema-location="classpath:schemas/emitterEvent.xsd" discard-channel="eventErrorChannel" /> <int-xml:xpath-header-enricher> <int-xml:header name="eventType" xpath-expression-ref="eventTypeExp" /> <int-xml:header name="eventAll" xpath-expression="/" /> </int-xml:xpath-header-enricher> <int:router default-output-channel="eventErrorChannel" expression="headers.eventType + 'RulesChannel'" /> </int:chain> <int:service-activator input-channel="testRulesChannel" output-channel="eventRouteChainChannel" expression="@routingMap.get(headers.eventType)" /> <int:chain input-channel="eventRouteChainChannel" output-channel="eventGatewayOutputChannel"> <int:splitter expression="payload" /> <int:header-enricher> <int:header name="eventRoute" expression="payload" /> </int:header-enricher> <int:service-activator expression="headers.eventAll" /> <int-xml:xslt-transformer xsl-resource="xsl/emitterEvent-to-event-transformer.xsl" /> </int:chain>