Amila,
MessageContext.getCurrentMessageContext() only work at Server side and
only after MessaeReceiver, so you cannot use this at the client side.
And also we cannot assume that user is going to invoke with a
MessageContext when he use ServiceClient APIs (I agree in the case of
OperationClient it does and that is why you do not have this issue with
generated code).
-Deepal
>
> hi,
>
> The ListnerManager.defaultConfigurationContext is used as an easy way
> to access the configuration context object within any place of the
> Axis2 container. But this would cause some security issues if we try
> to run multiple Axis2 instances in a single JVM. (For an example using
> Axis2 in an Multitenancy environment would cause problems with this).
>
>
> ListnerManager.defaultConfigurationContext is used in two places.
>
> 1.
>
> getMyEPR method of the service Context class
>
> This method is only uses in isEquivalent method which does not
> have any usage. So it is safe to delete both methods.
>
> 2.
>
> At the ServiceClient class to get the server Configuration
> context object.
>
> if (ListenerManager.defaultConfigurationContext == null) {
>
> configContext = ConfigurationContextFactory.
>
> createConfigurationContextFromFileSystem(null, null);
>
> ListenerManager.defaultConfigurationContext = configContext;
>
> createConfigCtx = true;
>
> } else {
>
> configContext = ListenerManager.defaultConfigurationContext;
>
> }
>
>
> This code is to get a server configuration context if a user invokes a
> service using service client at the skelton method. But here since
> configuration context can be read from the message context it can be
> replaced with this code.
>
> if (MessageContext.getCurrentMessageContext() == null) {
>
> configContext = ConfigurationContextFactory.
>
> createConfigurationContextFromFileSystem(null, null);
>
> createConfigCtx = true;
>
> } else {
>
> configContext =
> MessageContext.getCurrentMessageContext().getConfigurationContext();
>
> }
>
>
> Here with I have attach a patch with do the fix.
>
>
> WDYT?
>
>
> Thanks,
>
> Amila.
>
>
>
> --
> Amila Suriarachchi
> WSO2 Inc.
> blog: http://amilachinthaka.blogspot.com/
> ------------------------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
--
Thank you!
http://blogs.deepal.org
http://deepal.org
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]