在WSO2应用程序服务器中编写承租人感知的Web服务 [英] Writing tenant aware web service in wso2 application server

查看:64
本文介绍了在WSO2应用程序服务器中编写承租人感知的Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试开发将在WSO2 Application Server 5.0.1上部署的axis2 Web服务.当前,我们需要Web服务支持多租户,并且在某些Web服务中需要基于租户的某些过程.在服务上下文中,我需要从当前请求中检索租户信息.目前,我使用Application Server管理控制台test1.com和test2.com在本地环境中为租户创建.我如何才能从请求中检索域名以及test1.com和test2.com的租户ID,以及客户端应如何将Web服务调用到特定租户(例如,test1.com)?

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 ?

谢谢

推荐答案

您可以使用

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

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

请参考本文有关如何使用Carbon平台API的更多信息.

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

这篇关于在WSO2应用程序服务器中编写承租人感知的Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆