Hi Piriya, AFIK, we usually don't use handlers in Proxy services, we use handlers with REST APIs. The second approach you have followed, only valid for the axis2 handlers and I think that's why it wasn't getting invoked in your scenario. In order to handle your requirement, there are two other options to follow. I think the second option will be a better approach if I understood your requirement properly.
*1. Implement a Synapse Handler as in [1]* *2. Implements a custom class mediator and invoke it inside the proxy service* [1] https://docs.wso2.com/display/ESB490/Writing+a+Synapse+Handler Cheers, *Nadeeshaan Gunasinghe* Senior Software Engineer, WSO2 Inc. http://wso2.com +94770596754 | [email protected] | Skype: nadeeshaan.gunasinghe <#> <http://www.facebook.com/nadeeshaan.gunasinghe> <http://lk.linkedin.com/in/nadeeshaan> <http://twitter.com/Nadeeshaan> <http://nadeeshaan.blogspot.com/> Get your own email signature <https://wisestamp.com/email-install?utm_source=promotion&utm_medium=signature&utm_campaign=get_your_own> On Wed, Nov 22, 2017 at 10:18 AM, Piriya Sivalingam <[email protected]> wrote: > Hi, > > I have already copied the JAR to <ESB_HOME>/repository/components/lib > folder. > And also I have tried adding handler to the proxy via management console. > It gets removed when I save the proxy. > > On Wed, Nov 22, 2017 at 5:52 AM, Mushthaq Rumy <[email protected]> wrote: > >> Hi Piriya, >> >> Have you included the JAR or the OSGI bundle in your ESB pack? If not >> could you please add it. Can you try adding the handler to your proxy >> through management console? >> >> Thanks & Regards, >> Mushthaq >> >> On Tue, Nov 21, 2017 at 4:55 PM, Piriya Sivalingam <[email protected]> >> wrote: >> >>> Hi, >>> >>> I have a scenario where I have to decode the JWT token at the ESB layer >>> and fetch the user role from that token and validate at the ESB. I have a >>> handler to decode the generated JWT token and extract the role. I have >>> tried different ways in order to call that handler in my ESB proxy service. >>> >>> 1. Added the below code inside the synapse configuration of my proxy >>> service located at <ESB_HOME>/repository/deployme >>> nt/server/synapse-configs/default/proxy-services. >>> >>> <handlers> >>> <handler class="org.wso2.rest.JwtHandler"/> >>> </handlers> >>> >>> 2. Added the above code into the axis2.xml file located at >>> <ESB_HOME>/repository/conf/axis2/axis2.xml. >>> >>> I start the server in debug mode and noticed that handler does not get >>> executed. >>> >>> And according to the first method, whenever I make any changes to the >>> proxy, that (handler) gets removed. If I am not wrong, this is the expected >>> behavior. >>> >>> >>> Could you please suggest how can I call the handler inside my ESB proxy >>> service? >>> >>> The ESB version is ESB 5.0.0. >>> >>> Thanks, >>> Piriya >>> >>> -- >>> Regards, >>> >>> *Piriya Sivalingam* >>> >>> *Software Engineer - Support Team* >>> >>> *WSO2* >>> *Mobile : +94 77 8462039 <+94%2077%20846%202039>* >>> >>> [image: http://wso2.com/signature] <http://wso2.com/signature> >>> >>> >>> _______________________________________________ >>> Dev mailing list >>> [email protected] >>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>> >>> >> >> >> -- >> Mushthaq Rumy >> *Software Engineer* >> Mobile : +94 (0) 779 492140 <%2B94%20%280%29%20773%20451194> >> Email : [email protected] >> WSO2, Inc.; http://wso2.com/ >> lean . enterprise . middleware. >> >> <http://wso2.com/signature> >> > > > > -- > Regards, > > *Piriya Sivalingam* > > *Software Engineer - Support Team* > > *WSO2* > *Mobile : +94 77 8462039 <+94%2077%20846%202039>* > > [image: http://wso2.com/signature] <http://wso2.com/signature> > > > _______________________________________________ > Dev mailing list > [email protected] > http://wso2.org/cgi-bin/mailman/listinfo/dev > >
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
