Reputation: 7863
I have a instance of Mule that is configured to process xml responses from a third party provider. Recently the provider has moved to a new revision and hence changed the xml response. Now I need a way to identify if the response is a v1 or v2 implementation and call the appropriate endpoint on my side to process the response.
What I have currently is:
<service name="processResponse">
...
<outbound>
<pass-through-router>
<cxf:outbound-endpoint address="..." clientClass="..." wsdlPort="..." wsdlLocation="..." operation="..."/>
</pass-through-router>
</outbound>
</service>
I would prefer to add a filter in mule to identify the revision of the 3rd party (perhaps through the xml namespace in the response), and then call the appropriate class. I cannot find any good examples of this.
Can someone provide an example of how this could be solved?
Upvotes: 0
Views: 1815
Reputation: 36
I suspect the most straight forward means is a filtered route using an xpath filter. First define vm services for each version. Next you'll filter to them through a service with following outbound endpoint. A catch all is always a good idea.
<outbound>
<filtering-router>
<vm:outbound-endpoint ref="Version1"/>
<expression-filter evaluator="jxpath" expression="/your/version1/xpath/descriminator"/>
</filtering-router>
<filtering-router>
<vm:outbound-endpoint ref="Version2"/>
<expression-filter evaluator="jxpath" expression="/your/version2/xpath/descriminator"/>
</filtering-router>
<forwarding-catch-all-strategy>
<stdio:outbound-endpoint system="ERR"/>
</forwarding-catch-all-strategy>
</outbound>
Upvotes: 0
Reputation: 33413
Take a look at this example, where some version transformation is demonstrated.
Upvotes: 1