0
votes

my configuration sees an instance of WSO2 ESB 4.7.0 and a separated Tomcat WebServer on which i expose some REST Services. On the ESB i have published a pass-through proxy service redirecting to the tomcat REST web services all client requests. I need to catch all the REST requests from the clients towards the proxy in a way that i can trigger some API or some classes method written by myself. Is there a feature on the ESB matching with this function? Or have i to develop my custom proxy? thanks

2

2 Answers

0
votes

For your requirement of posting and getting response form REST backend you can use HTTP end point as shown below

   <send>
       <endpoint>
             <http method="get" uri-template= "http://localhost:8080/rest/api/people/{uri.var.email}"/>
       </Endpoint>
   </send>  

The sample proxt service can be found at [1]

For your second requirement you have to write a class mediator and call your API from particular class. Details on class mediator can be found at [2].

Hope this will help you

[1]. http://dharshanaw.blogspot.com/2013/09/people-rest-service-sample-proxy.html [2]. http://docs.wso2.org/display/ESB460/Class+Mediator

0
votes

You can intercept message flow by writing a custom mediator. Then you can handle all the request with that mediator. you can follow this link to write a class mediator. It describes all the step to create your jar file and install it in the ESB.

http://soatutorials.blogspot.com/2013/08/10-minute-tutorial-for-extending-wso2.html