One way of having a RESTful service in Mule is:
1) Use http:listener
<http:listener-config name="HTTPListener" host="127.0.0.1" port="8080"/>
2) Exploit regex and choice
<flow name="restFlow">
<http:listener config-ref="HTTPListener" path="/path*" doc:name="HTTP"/>
<choice doc:name="Choice">
<when expression="#[regex('/path', message.inboundProperties['http.request.path'])]">
<json:json-to-object-transformer returnClass="java.util.HashMap" />
<logger message="INCOMING: #[message.inboundProperties['http.request.path']] PAYLOAD: #[message.payload]" level="INFO"/>
<set-property propertyName="success" value="true" doc:name="Property"/>
<set-payload value="#[new java.util.HashMap()]"/>
<expression-transformer expression="#[
message.payload.success=message.outboundProperties.success;
message.payload]" />
<json:object-to-json-transformer doc:name="Object to JSON"/>
</when>
<otherwise>
<logger message="UNSUPPORTED" level="INFO"/>
</otherwise>
</choice>
You should get JSON back.