Sample 440: Respond Mediator - Echo Service with a Proxy Service

<definitions xmlns="http://ws.apache.org/ns/synapse"> <proxy name="EchoService"> <target> <inSequence> <respond/> </inSequence> </target> </proxy> </definitions>

Objective

Demonstrate how to use respond mediator to create a simple echo service

Pre-requisites

  • Start Synapse using the configuration numbered 440 (repository/conf/sample/synapse_sample_440.xml)
    Unix/Linux: sh synapse.sh -sample 440
    Windows: synapse.bat -sample 440

Executing the Client

Invoke the EchoService proxy service with a payload. Following is how we can use curl as the client.

curl -v -X POST -H "Content-type: application/xml" -d '<test>foo</test>' 'http://localhost:8280/services/EchoService'

Back to Catalog