How to Inject Messages to a RESTful Endpoint¶ In order to use the Message Injector to inject messages to a RESTful endpoint, you can specify the injector with the required payload and inject the message to the sequence or proxy service as defined below. The sample below shows a RESTful message injection through a proxy service. Synapse configurations¶ Following are the integration artifacts that we can used to implement this scenario. See the instructions on how to build and run this example. Scheduled triggerProxy ServiceEndpoint <task class="org.apache.synapse.startup.tasks.MessageInjector" group="synapse.simple.quartz" name="SampleInjectToProxyTask" xmlns="http://ws.apache.org/ns/synapse"> <trigger count="2" interval="5"/> <property name="injectTo" value="proxy" xmlns:task="http://www.wso2.org/products/wso2commons/tasks"/> <property name="message" xmlns:task="http://www.wso2.org/products/wso2commons/tasks"> <request xmlns=""> <location> <city>London</city> <country>GB</country> </location> </request> </property> <property name="proxyName" value="SampleProxy" xmlns:task="http://www.wso2.org/products/wso2commons/tasks"/> </task> <?xml version="1.0" encoding="UTF-8"?> <proxy name="SampleProxy" startOnLoad="true" transports="http https" xmlns="http://ws.apache.org/ns/synapse"> <target> <inSequence> <property expression="//request/location/city" name="uri.var.city" scope="default" type="STRING"/> <property expression="//request/location/country" name="uri.var.cc" scope="default" type="STRING"/> <log> <property expression="get-property('uri.var.city')" name="Which city?"/> <property expression="get-property('uri.var.cc')" name="Which country?"/> </log> <call> <endpoint key="EP" /> </call> <log level="full"/> <respond /> </inSequence> <faultSequence/> </target> </proxy> <endpoint name="EP" xmlns="http://ws.apache.org/ns/synapse"> <http method="get" uri-template="http://api.openweathermap.org/data/2.5/weather?q={uri.var.city},{uri.var.cc}&APPID=ae2a70399cf2c35940a6538f38fee3d3" /> </endpoint> Build and run¶ Create the artifacts: Launch Visual Studio Code with the WSO2 Integrator: MI for VS Code extension (MI for VS Code) installed. Info Follow the Install WSO2 Integrator: MI for VS Code documentation for a complete installation guide. Create an integration project. Create the proxy service, endpoint, and a Scheduled trigger with the configurations given above. Deploy the artifacts in your WSO2 Integrator: MI. The XML message you injected (i.e., This is a Scheduled trigger of the default implementation.) will be printed in the logs of the WSO2 Integrator: MI twice, 5 seconds apart. INFO {org.apache.synapse.mediators.builtin.LogMediator} - Which city? = London, Which country? = UK