After adding MtoM enabled onto a business service running in Jboss 7, we found that passing soap requests through Mule now causes an error:-
<faultstring>An exception occurred while invoking message processor "DefaultMessageProcessorChain '(inner iterating chain) of OutboundEndpoint 'http://127.0.0.1:8280/communication' request chain'
[
org.mule.endpoint.outbound.OutboundEventTimeoutMessageProcessor,
org.mule.endpoint.outbound.OutboundSessionHandlerMessageProcessor,
org.mule.endpoint.outbound.OutboundEndpointPropertyMessageProcessor,
org.mule.endpoint.outbound.OutboundResponsePropertiesMessageProcessor
]" with transaction "Transaction{factory=null, action=NEVER, timeout=0}".. Message payload is of type: PostMethod</faultstring>
Which would appear to be caused by a validation error that happens when the payload from the service response is validated before being passed back to SOAPUI. Checking the Mule log file, this is logged:
Caused by: org.apache.cxf.binding.soap.SoapFault: Error reading XMLStreamReader.
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:222)
at ... 80 more
Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '-' (code 45) in prolog; expected '<'
at [row,col {unknown-source}]: [1,1]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:644)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2003)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1100)
at com.ctc.wstx.sr.BasicStreamReader.nextTag(BasicStreamReader.java:1123)
at org.mule.module.xml.stax.DelegateXMLStreamReader.nextTag(DelegateXMLStreamReader.java:242)
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:122)
... 90 more
The error seems to occur because MULE attempts to parse the soap response as XML in validatingStreamReader, when in fact the SOAP envelope has the following text in the header:
[------=_Part_22_1884954755.1363694621407 Content-Type:application/xop+xml;charset=utf-8;type="text/xml"
<SOAP-ENV:Envelope.....
So the validation is failing because the MtoM markup is making the SOAP packet malformed.
Below is my mule config
<!-- Primary Choice router is used to forward requests to the wsdl proxy
and SOAPflow this should be the only endpoint that is exposed to the public
domain. -->
<flow name="SOAInboundRouter">
<!-- public inbound listener -->
<inbound-endpoint address="${web.inboundAddress}"
exchange-pattern="request-response" />
<!-- Outbound filter for routing requests -->
<choice>
<when>
<regex-filter pattern="soap" />
<outbound-endpoint
address="${soa.inboundAddress}#[header:inbound:http.request]"
exchange-pattern="request-response" />
</when>
</choice>
</flow>
<!-- Flow used for SOAP request processing, this implements a callback to
check the SOAP header for the correct username token for WS-Security request
are passed to this flow by the Flow SOAInboundRouter. This endpoint is not
for use in the public domain. -->
<flow name="SoapFlow">
<!-- http listener for SOAP requests -->
<inbound-endpoint address="${soa.inboundAddress}"
exchange-pattern="request-response">
<cxf:proxy-service service="" namespace="">
<!-- WS-Security intercetor applied to the inbound request -->
<cxf:inInterceptors>
<spring:ref bean="cxfSecurityInterceptor" />
</cxf:inInterceptors>
</cxf:proxy-service>
</inbound-endpoint>
<!--Success on authentication request is passed to outbound router this
is the actual service -->
<outbound-endpoint
address="${soa.outboundAddress}#[header:inbound:http.request]"
exchange-pattern="request-response">
<cxf:proxy-client />
</outbound-endpoint>
</flow>
<!-- application configuration -->
<spring:bean id="cxfSecurityInterceptor"
class="uk.co.weatherbys.security.esb.cxf.CXFSecurityInterceptor"
scope="prototype">
<spring:constructor-arg value="${mule.userfile}" />
<spring:property name="wServiceHeaderDelegate" ref="wServiceHeaderDelegate" />
<spring:property name="cxfWsSecurityDelegate" ref="cXfWsSecurityDelegate" />
</spring:bean>
<spring:bean id="wServiceHeaderDelegate"
class="uk.co.weatherbys.security.esb.cxf.WServiceHeaderDelegate">
</spring:bean>
<spring:bean id="cXfWsSecurityDelegate"
class="uk.co.weatherbys.security.esb.cxf.CxfWsSecurityDelegate">
</spring:bean>
I've checked everywhere for a solution, but cannot find one. Does anyone have any suggestions? Can I turn off the outbound validation somehow? Do I need to configure a transformer to handle this non-standard header information? Do I need a new flow?
Thanks