Reputation: 528
I am having a mule flow in which I am having a variable to which payload is copied as follows:
<set-variable variableName="originalPayload" value="#[payload]" doc:name="Variable" doc:description="Variable having copy of original payload present in soap request."/>
After this there is an interceptor that validates header of soap message and if validation fails then I need the above variable's data in interceptor to prepare custom fault message. Below is my configuration for Soap Proxy doing above:
<cxf:proxy-service port="XXX" namespace="XXX" service="XXX" payload="body" wsdlLocation="XXXX" doc:name="SOAP" doc:description="Soap proxy intercept soap request and apply header validation. Authentication and custom header will be validated for presence, content, and structure.">
<cxf:inInterceptors>
<spring:bean id="XXXX" parent="XXXX">
<spring:property name="sourceApplication" value="${sourceApplication}"/>
<spring:property name="originalMessage" value="#[originalPayload]"/>
</spring:bean>
</cxf:inInterceptors>
</cxf:proxy-service>
In above I need the value of originalPayload variable in originalMessage property of spring bean. If I can copy #[payload] directly it will work too. Above expression in spring property is not valid so it is not working.
Please suggest how to go for this.
Implementing Callable can be one option but I do not want to change the code written already unless there is no solution for above.
I tried to search for solution on this but could not find anything.
Thanks Harish Kumar
Upvotes: 0
Views: 1285
Reputation: 3264
The problem with your solution is that spring properties are set at configuration time whereas the #[payload]
expression could be only resolved at runtime.
However within your interceptor you could retrieve the original payload from the CXF message by doing something like this:
MuleEvent event = (MuleEvent) message.getExchange().get(CxfConstants.MULE_EVENT);
Collection<Attachment> a = event.getMessage().getInvocationProperty("originalPayload");
You can refer to this interceptor as an example
Upvotes: 1