You're completely right Rajesh, sorry, I jumped the gun without having a proper look in my reply.
Your fix looks correct except that we need to move dispatcher/delegator to local variables rather than instance fields. The EventHandler objects are singletons shared among all incoming requests so we don't want to store request-specific objects in fields that are accessed by all requests or the results will get pretty unpredictable for concurrent requests across multiple tenants. Regards Scott On 16 March 2018 at 07:01, Rajesh Mallah <mallah.raj...@gmail.com> wrote: > Hi Scott , > > I could get it to work by setting dispatcher and delegator only. > I referred SOAPEventHandler.java which handles tenants fine. > > I could not see userLogin handling tenantId as suggested by you, > can you please see the below and tell if it is correct. > > Do we have test coverage to see if does not break anything else? > > $ diff -u5 XmlRpcEventHandler.java.orig XmlRpcEventHandler.java > --- XmlRpcEventHandler.java.orig 2018-03-15 23:29:46.954352066 +0530 > +++ XmlRpcEventHandler.java 2018-03-15 23:29:51.734435105 +0530 > @@ -91,10 +91,12 @@ > /** > * @see > org.apache.ofbiz.webapp.event.EventHandler#invoke(ConfigXMLReader.Event, > ConfigXMLReader.RequestMap, javax.servlet.http.HttpServletRequest, > javax.servlet.http.HttpServletResponse) > */ > public String invoke(Event event, RequestMap requestMap, > HttpServletRequest request, HttpServletResponse response) throws > EventHandlerException { > String report = request.getParameter("echo"); > + dispatcher = (LocalDispatcher) request.getAttribute(" > dispatcher"); > + delegator = (Delegator) request.getAttribute("delegator"); > if (report != null) { > BufferedReader reader = null; > StringBuilder buf = new StringBuilder(); > try { > // read the inputstream buffer > > > > On Thu, Mar 15, 2018 at 9:51 PM, Scott Gray <scott.g...@hotwaxsystems.com> > wrote: > > > Hi Rajesh, > > > > It looks like the XmlRpcEventHandler class doesn't support this but it > > could easily be modified to do so. I'd suggest filing a ticket, and > > perhaps even providing a patch :-) > > > > The tenantId just needs to be derived from the url and then passed into > the > > userLogin service in the OfbizRpcAuthHandler.isAuthorized(...) method. > > > > Regards > > Scott > > > > On 16 March 2018 at 00:22, Rajesh Mallah <mallah.raj...@gmail.com> > wrote: > > > > > Hello All , > > > > > > Is it possible to direct the webservice call to a particular tenant > using > > > XMLRPC? > > > > > > I am referring to > > > > > > > > > https://cwiki.apache.org/confluence/display/OFBIZ/Using+XMLRPC+as+an+ > > > alternative+to+SOAP > > > > > > > > > consider the snippet > > > > > > ======================================================= > > > XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); > > > config.setServerURL(new URL(" > > > http://127.0.0.1/webtools/control/xmlrpc" > > > <http://127.0.0.1/webtools/control/xmlrpc>)); > > > config.setEnabledForExceptions(true); > > > config.setEnabledForExtensions(true); > > > > > > XmlRpcClient client = new XmlRpcClient(); > > > client.setConfig(config); > > > > > > Map paramMap = new HashMap(); > > > paramMap.put("login.username", "admin"); > > > paramMap.put("login.password", "ofbiz"); > > > paramMap.put("idToFind", "admin"); > > > ============================================================ > =========== > > > I tried setting the host part of serverUrl to domain_name of > > > tenant_domain_name . > > > > > > I find that the requests always work on the first tenant . > > > i need to work with a specific tenant . > > > > > > Any help is solicited. > > > > > > regds > > > mallah. > > > > > >