问题
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