...
- format - defines the format of the message similar to Address Endpoint formats: soap11, soap12, pox, get
message - you can provide an XML or literal value depending on message format.
Note title Note When adding a scheduled task, it is mandatory to provide a value for the message property. Therefore, even If you do not want to send a message body, you have to provide an empty payload as the value to avoid an exception being thrown.
- soapAction - specify the SOAP Action to use when sending the message to the endpoint.
- to - specify the endpoint address.
- injectTo - specify whether to inject a message to a proxy service or sequence. This field takes values 'sequence' or 'proxy' and 'main' to inject to main sequence.
- proxyName - if injectTo contains 'proxy' then the name of the proxy to inject the message to is specified here.
- sequenceName - if injectTo contains 'sequence' then the name of the sequence to inject the message to is specified here.
...
Code Block | ||||
---|---|---|---|---|
| ||||
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://ws.apache.org/ns/synapse">
<registry provider="org.wso2.carbon.mediation.registry.WSO2Registry">
<parameter name="cachableDuration">15000</parameter>
</registry>
<proxy name="SampleProxy"
transports="https http"
startOnLoad="true"
trace="disable">
<description/>
<target>
<inSequence>
<property name="uri.var.city" expression="//request/location/city"/>
<property name="uri.var.cc" expression="//request/location/country"/>
<log>
<property name="Which city?" expression="get-property('uri.var.city')"/>
<property name="Which country?" expression="get-property('uri.var.cc')"/>
</log>
<send>
<endpoint name="EP">
<http method="get"
uri-template="http://api.openweathermap.org/data/2.5/weather?q={uri.var.city},{uri.var.cc}"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<log level="full"/>
<drop/>
</outSequence>
</target>
</proxy>
<task name="SampleInjectToProxyTask"
class="org.apache.synapse.startup.tasks.MessageInjector"
group="synapse.simple.quartz">
<trigger count="2" interval="5"/>
<property xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
name="injectTo"
value="proxy"/>
<property xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="message">
<request xmlns="">
<location>
<city>London</city>
<country>UK</country>
</location>
</request>
</property>
<property xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
name="proxyName"
value="SampleProxy"/>
</task>
</definitions> |