How to set delegator based on tenantId passed via web service?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How to set delegator based on tenantId passed via web service?

arini.rusda
Hi, I am trying to using multitenancy support ofbiz, but when it comes to web service i got confused.

I have a service in java which has option "export=true". In this service, i am doing some query to database. Because now i'm implementing multitenancy, i got confused how to make the delegator choose the appropriate connection to the appropriate schema. I am making the tenantId as one of the IN parameter but i don't know what to do with it. Any hints?
Best Regards,
Arini Rusda
Informatics Department, Sepuluh Nopember Institute of Technology
Reply | Threaded
Open this post in threaded view
|

Re: How to set delegator based on tenantId passed via web service?

Jacques Le Roux
Administrator
I guess nobody did it before. If  you do it, you could add your experience to the Multi Tenant page in wiki
https://cwiki.apache.org/confluence/display/OFBIZ/Multitenancy+support

TIA

Jacques

From: "arini.rusda" <[hidden email]>

> Hi, I am trying to using multitenancy support ofbiz, but when it comes to web
> service i got confused.
>
> I have a service in java which has option "export=true". In this service, i
> am doing some query to database. Because now i'm implementing multitenancy,
> i got confused how to make the delegator choose the appropriate connection
> to the appropriate schema. I am making the tenantId as one of the IN
> parameter but i don't know what to do with it. Any hints?
>
> -----
> Best Regards,
> Arini Rusda
> Informatics Department, Sepuluh Nopember Institute of Technology
> --
> View this message in context:
> http://ofbiz.135035.n4.nabble.com/How-to-set-delegator-based-on-tenantId-passed-via-web-service-tp3673046p3673046.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: How to set delegator based on tenantId passed via web service?

rajsaini
Sorry for the late reply. You can extend the controller servlet to add
this multi-tenant functionality. It may not be straight forward and you
may to fixes issues here and there. I don't remember the all the details
but I think I had to change some thing in the ContextFilter apart from
the control servlet. Sample code snippet is:

   String tenantId = request.getParameter("tenantId");
   delegator = DelegatorFactory.getDelegator("default#"+ tenantId);


I think you can also write your on filter and chain it in the request
pipeline though, I have not tried this myself.

Thanks,

Raj

On Sunday 24 July 2011 05:55 PM, Jacques Le Roux wrote:

> I guess nobody did it before. If  you do it, you could add your
> experience to the Multi Tenant page in wiki
> https://cwiki.apache.org/confluence/display/OFBIZ/Multitenancy+support
>
> TIA
>
> Jacques
>
> From: "arini.rusda" <[hidden email]>
>> Hi, I am trying to using multitenancy support ofbiz, but when it
>> comes to web
>> service i got confused.
>>
>> I have a service in java which has option "export=true". In this
>> service, i
>> am doing some query to database. Because now i'm implementing
>> multitenancy,
>> i got confused how to make the delegator choose the appropriate
>> connection
>> to the appropriate schema. I am making the tenantId as one of the IN
>> parameter but i don't know what to do with it. Any hints?
>>
>> -----
>> Best Regards,
>> Arini Rusda
>> Informatics Department, Sepuluh Nopember Institute of Technology
>> --
>> View this message in context:
>> http://ofbiz.135035.n4.nabble.com/How-to-set-delegator-based-on-tenantId-passed-via-web-service-tp3673046p3673046.html
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: How to set delegator based on tenantId passed via web service?

arini.rusda
Hi, thanks for the reply :)

What rajsaini said works for me. And it doesn't require to change anything in ContextFilter.

Thanks.
Best Regards,
Arini Rusda
Informatics Department, Sepuluh Nopember Institute of Technology
Reply | Threaded
Open this post in threaded view
|

Re: How to set delegator based on tenantId passed via web service?

fansey@gmail.com
could you please share your code patch or commit your change to trunk?