axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glen Daniels <>
Subject RE: MessageContext
Date Fri, 25 Jan 2002 14:12:03 GMT

Hi Cedric!

Thanks for the note.

As I see it, the problem isn't so much that we don't set the current MessageContext when generating
WSDL (although it's not a bad idea to do so), but that an object is getting created for what
is essentially a class-based activity (introspection).

I think we create the object mostly so we can see if it implements AxisServiceConfig and then
call the getMethods() method on it if so.  Everything else we do is based on the class.  So
my proposal would be to switch AxisServiceConfig from an interface which target classes implement
to an object which gets returned from a static method - something like this:

class MyServiceClass {
   private static AxisServiceConfig serviceConfig;
   public static AxisServiceConfig _getAxisServiceConfig()
      if (serviceConfig == null) {
          // initialize serviceConfig object appropriately
      return serviceConfig;

This would enable the engine to just load the class and introspect for the static method,
rather than creating an actual instance and going through potentially unnecessary initialization


> -----Original Message-----
> From: Cédric Chabanois []
> Sent: Friday, January 25, 2002 8:19 AM
> To: ''
> Subject: MessageContext
> Hi,
> In my [...]BindingImpl file, I have an init method that is 
> called when the
> constructor itself is called.
> In this method, i want to get what is the path to the WEB-INF 
> subdirectory,
> so I did the following :
> MessageContext msgContext = MessageContext.getCurrentContext();
> String configPath = msgContext.getStrProp(Constants.MC_CONFIGPATH);
> But an instance of this class is created when user wants the 
> wsdl (?wsdl)
> and msgContext is null in this case.
> Indeed in AxisServer.invoke, 
> setCurrentMessageContext(msgContext) is called
> but this is not the case in AxisServer.generateWSDL.
> I could also call init in each method (testing in init if I 
> already done
> what I wanted), but I would prefer not to do this.
> Is there any reason why currentMessageContext is not 
> available when the
> request is ?wsdl ?
> Another question : I know that methods can take 
> MessageContext as first
> parameter. So what is the best method : take a MessageContext as first
> parameter or get it with MessageContext.getCurrentContext() ?
> Thanks,
> Cédric Chabanois

View raw message