Writing tenant aware web service in wso2 application server

我是研究僧i 提交于 2019-12-11 05:50:19

问题


I am trying to develop a axis2 web service to be deployed on WSO2 Application Server 5.0.1. Currently we have requirement, that web services support multi-tenancy and in some web services some process based on tenant. Upon the service context i need to retrieve tenant information from the current request. Currently i create to tenant in my local environment using Application Server management console test1.com and test2.com. How can i retrieve domain name and if possible tenant id of test1.com and test2.com from request and how should client call the web service to a specific tenant, for example to test1.com ?

Thanks


回答1:


You can use CarbonContext to retrieve current tenant and other stuffs.

 CarbonContext cCtx = CarbonContext.getCurrentContext();
    cCtx.getTenantDomain();
    cCtx.getTenantId();

Refer this article for more information on how to use carbon platform APIs.



来源:https://stackoverflow.com/questions/14018585/writing-tenant-aware-web-service-in-wso2-application-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!