开发者

Communicate between services in axis2?

We have a web service implementation which maintains a bit of internal state. Now we want to开发者_高级运维 add a separate web service interface which accesses the same internal state of the first web service. Essentially, it'd be two interfaces into the same underlying program. We can package the two web services within the same AAR file, as two services in the same service group.

In this setup, would the two services share a classloader (in which case they could share instantiated classes)? Or is there some other axis2 mechanism for the two implementations to communicate with each other?


It turns out that this "just works". If two services are part of the same service group, then they will use the same classloader. That means they'll have access to the same set of static variables and singletons.

Axis2 also allows you to add parameters to certain configuration objects. Each parameter consists of a name-value pair, where the value can be any object. The environment-wide AxisConfiguration can be used to store parameters which are visible to any other service running within the environment. Within your ServiceLifecycle.startUp() function, call getAxisConfiguration() on the ConfigurationContext argument to retrieve the AxisConfiguration. Then use addParameter() and getParameter() to access parameters.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜