axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ramon Turnes <ramon.turnes-pe...@hermes.si>
Subject RE: Passing Start-Up Parameters to a WEB Service
Date Fri, 13 Sep 2002 07:46:58 GMT
We are doing the following, we have a Web Service whose scope is application
and auto configures the first time is invoked. This is a snippet of the code
we
are using:


//Here you have the deployment file
 <service name="MyService" provider="java:MSG" >
    <parameter name="className"       value="myServiceClass"/>
    <parameter name="allowedMethods"  value="entryPoint"/>
    <parameter name="configFile"
value="c:\\userDefinedConfigFilename"/>
    <parameter name="scope"           value="application"/>
  </service>


//Configuration method
    private Document getConfiguration(MessageContext msgc) {
        Document    config = null;
        InputStream is     = null;

        
        //Reads a option from the deployment information
        String filename = (String) msgc.
            getService().getOption("configFile");

        try {
            //Search for a default file if no option is provided
            if (filename == null) {
               //When running under Tomcat this would point to 
               //$TOMCAT_HOME/webapps/axis/WEB-INF
                String servletLocation = (String) msgc.
                    getProperty(HTTPConstants.MC_HTTP_SERVLETLOCATION);

                if (servletLocation != null) {
                    filename = servletLocation + "/" +
"defaultConfigFilename";
                } else {
                    filename = CONFIG_FILENAME;
                }
                is = new FileInputStream(filename);
            } else {
                is = new FileInputStream(filename);
            }
        } catch (FileNotFoundException e) {
            log.info("getConfiguration(): file " + filename + " not found");
            return null;
        }

        try {
            DocumentBuilder docBuilder =
                DocumentBuilderFactory.newInstance().newDocumentBuilder();

            config = docBuilder.parse(is);
        } catch (Exception e) {
            log.debug("getconfiguration() : error parsing config file");
            return null;
        }

        return config;
    }

We did not file any other way of defining it. Regards.

-----Original Message-----
From: Smith, Larry [mailto:xlis@ti.com]
Sent: Friday, September 13, 2002 1:50 AM
To: 'axis-user@xml.apache.org'
Subject: RE: Passing Start-Up Parameters to a WEB Service


We have a pre-defined environment in which to work; ldap/jndi are 
not an option..... 
The service(s) have a "re-read your config" method that will be called 
by other apps which change things of interest to the service(s). 
So, we need either: 
        a) the ability for the service to find it's "home" directory at
start-up 
        b) a way to pass dynamic start-up args which can (among other
things) 
           define the "home" directory. 
Thanks & Regards, 
Larry 
-----Original Message----- 
From: Steve Loughran [mailto:steve_l@iseran.com] 
Sent: Thursday, September 12, 2002 6:42 PM 
To: axis-user@xml.apache.org 
Subject: Re: Passing Start-Up Parameters to a WEB Service 


you can put config stuff into web.xml 
Talking to a directory service (ldap/jndi) is widely recognised as better, 
as you can change stuff on a live system without a rebuild. 
----- Original Message ----- 
From: "Smith, Larry" <xlis@ti.com> 
To: <axis-user@xml.apache.org> 
Sent: Thursday, September 12, 2002 3:32 PM 
Subject: Passing Start-Up Parameters to a WEB Service 


> Is there any way to pass start-up parameters to a WEB Service running 
> under Axis? 
> 
> I've tried adding an init() method, but it never gets invoked. 
> 
> I've tried adding custom <parameter.../> entries to deploy.wsdd 
> 
> We need a way to tell a WEB Service where to find various config 
> files and directories, which database to use, etc, when it starts up. 
> 
> See the message thread for "Finding a WEB Service's Directory" for 
> info about the in-ability to determine the services "home" directory. 
> 
> Since we can't portably derive the service's "home" directory, then the 
> ability to supply it with start-up parameters could be used to 
> accomplish the same task. 
> 
> Thanks & Regards, 
> Larry 
> 
> 

Mime
View raw message