Using the switch interceptor Membrane allows you to route XML messages based on XPath expressions.
In this example we will route three XML messages based on their content to three different destinations.
To test the router we will use the command line tool curl that can transfer data with URL syntax. You can download it form the following location: http://curl.haxx.se/download.html
To run the example execute the following steps:
-
Go to the folder
examples/cbr
-
Start Membrane:
service-proxy.sh
or
service-proxy.bat
- Send an order XML document to the API:
curl -d @order.xml localhost:2000
- Take a look at the output of the console. You should see the line:
"Normal order received."
- Send an express order to the API:
curl -d @express.xml localhost:2000
Express order received.
- Send an import document:
curl -d @import.xml localhost:2000
Order contains import items.
See:
- switch reference