如何在wso2 ESB中全局设置属性 [英] how to set a property globally in wso2 ESB

查看:173
本文介绍了如何在wso2 ESB中全局设置属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图弄清楚如何在wso2 esb中实现会话管理.所以我写了一个类调解器来生成要存储的session_ID.为存储会话ID,我使用以下代码:

I am trying to figure out how to implement session management in wso2 esb.So i have written a class mediator which generates session_ID that i want to store.For storing the session id I am using following code as:

org.apache.axis2.context.ServiceContext serviceContext = org.apache.axis2.context.MessageContext
            .getCurrentMessageContext().getServiceContext();
serviceContext.setProperty("SessionIDGlobal", uuid);

但是在我的esb代理中运行它时,它在getCurrentMessageContext部分抛出了空指针异常.我遵循了另一种方法,其中我将sessionID存储在属性中介器中并试图获取其值,但是当我在generateSessionID之后单击postRequest操作时从try-it操作.所有属性都将重置,而我的sessionID属性为我提供了空值.我应该怎么做才能纠正这个问题?有其他替代方法吗?

But while running it in my esb's proxy it throws null pointer exception at getCurrentMessageContext part.I have followed another approach where-in i am storing the sessionID in property mediator and tried to get its value but when i click postRequest operation after generateSessionID operation from try-it. all the property gets reset and my sessionID property gives me null value. What should i do to rectify this problem? Is there any alternate way?

推荐答案

您必须像这样创建servicecontext;

You have to create servicecontext like this;

ConfigurationContext cfgCtx =(((Axis2MessageContext) synCtx).getAxis2MessageContext(). getConfigurationContext();

cfgCtx.getOperationContext().getServiceContext();

这篇关于如何在wso2 ESB中全局设置属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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