This sample demonstrates, how to create XML from a template and how to read XML from a request.
Use the template plugin to create body content from a template. Placeholders in the template can be filled with values from variables. See the text template sample for how to access variables.
Execute the following steps:
-
Go to the
examples/templating/xmldirectory. -
Have a look at
proxies.xml. -
Open a commandline and execute
membrane.shormembrane.cmd -
Run this command from a second commandline:
❯ curl -d '<person firstname="Juan"/>' -H 'content-type: application/xml' http://localhost:2000 Buenas Noches, Juansito!
-
To run the second example execute:
❯ curl -d @cities.xml -H 'content-type: application/xml' http://localhost:2001 <destinations> <answer>42</answer> <destination>Hong Kong</destination> <destination>Tokio</destination> <destination>Berlin</destination> </destinations>
See:
- template reference