Nice analysis. Proposed solution looks good. Please implement it & test for any regression issues.
On Thu, May 24, 2012 at 2:33 PM, Nirmal Fernando <[email protected]> wrote: > Hi All, > > Finally I've been able to find the root cause for the $subject and the > solution. > > *Scenario*: > > * A tenant change its main sequence to something like following. > > <sequence xmlns="http://ws.apache.org/ns/synapse" name="main" > trace="enable"> > <in> > <send> > <endpoint> > <address uri=" > http://appserver.stratoslive.wso2.com/services/t/a.com/SimpleStockQuoteService" > format="soap11" /> > </endpoint> > </send> > </in> > <out> > <send /> > </out> > </sequence> > > * A client trying to access this tenant's services through a REST call. > > *Explanation to the problem:* > > * In the product this works like following: > > * Since ESB doesn't have any real service in it, what Synapse (RESTUtil) > does is set its default service property as the axis-service in > MessageContext in order to inject the request into the main sequence. > Following code handles that: > > if (axisService == null) { > String defaultSvcName = > NHttpConfiguration.getInstance().getStringValue( > "nhttp.default.service", "__SynapseService"); > axisService = msgContext.getConfigurationContext() > .getAxisConfiguration().getService(defaultSvcName); > } > msgContext.setAxisService(axisService); > > * But in the service's case, finding the service should be done carefully, > since we need to access relevant tenant's main sequence, not super admin's. > > > *Proposing Solution*: > > * Currently in > org.wso2.carbon.core.multitenancy.MultitenantMessageReceiver's doNhttpREST > method, we are processing a REST message coming in from the NHTTP transport. > * For this method we're passing the "service name". > if service URL is > http://esb.cloud-test.wso2.com:8280/services/t/test.com/myproxy : service > name is "myproxy" > if service URL is > http://esb.cloud-test.wso2.com:8280/services/t/test.com : service name is > "" > * Hence, I think we could safely assume that if service name is "", the > request should go to the default service i.e. "__SynapseService" of that > particular tenant. > * Thus, we can set the axis-service of the message context of that tenant > to this default service within MultitenantMessageReceiver's doNhttpREST > method. > * The code portion I've added is following: > > // handling requests with an empty service part > if("".equals(servicePart)){ > // we assume that the request should go to the default service > > tenantInMsgCtx.setAxisService(tenantConfigCtx.getAxisConfiguration().getService("__SynapseService")); > } > > > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ > If you have any concerns with the above approach please fire them up ASAP. > > > -- > > Thanks & regards, > Nirmal > > Software Engineer- Platform Technologies Team, WSO2 Inc. > Mobile: +94715779733 > Blog: http://nirmalfdo.blogspot.com/ > -- *Afkham Azeez* Director of Architecture; WSO2, Inc.; http://wso2.com Member; Apache Software Foundation; http://www.apache.org/ * <http://www.apache.org/>** email: **[email protected]* <[email protected]>* cell: +94 77 3320919 blog: **http://blog.afkham.org* <http://blog.afkham.org>* twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez> * linked-in: **http://lk.linkedin.com/in/afkhamazeez* * * *Lean . Enterprise . Middleware*
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
