<?xml version=”1.0” encoding=”UTF-8”?>
<api xmlns=”http://ws.apache.org/ns/synapse”
name=”SelfcareMobile”
context=”/a/b”>
<resource methods=”POST” url-mapping=”/c/*”>
<inSequence>
<property name=”messageType”
value=”application/json”
scope=”axis2”
type=”STRING”/>
<property name=”contentType”
value=”application/json”
scope=”axis2”
type=”STRING”/>
<log level=”full”/>
<send>
<endpoint>
<http format=”rest”
method=”post”
uri-template=”YOUR_BACK_END_URL”/>
</endpoint>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
</resource>
</api>
*** URL-mapping
Lets say our external url (which we give to outside )will be “http://www.mysite.com/a/b/c/someservice” and back end service will be “http://yourip:port/something/c/someservice" .
Then our url context for the api will be “/a/b”. Which means what has the url pattern of “/a/b” should go into this API.
url-mapping will be “/c/*” which meas what ever has “/c” and after what ever string should use the given resource.
Last not least, our endpoint address should be like below. (note “uri-template” which is the back end address of the real REST service.
<http format=”rest”
method=”post”
uri-template=”http://yourip:port/something”/>
Yeah you see it right, we ommit the “/c/someservice" part from real back end url because when we tell to url-mapping in the resource tag it will put that part and append it to the uri-template to determine the final destination.