You can use two approaches. First, you can define your own parameters at
deployment
time or you can expect a file located in axis installation under Tomcat. I
am passing the
name of a config file to my web service. The following code reads a
configuration file.
Either it uses the value of a property named CONFIG_FILENAME_LOCATION which
can be set at deployment time or a file named CONFIG_FILENAME to be located
in
axis\WEB-INF directory under Tomcat:
private void configure(MessageContext msgc) {
try {
InputStream is = null;
String filename = (String) msgc.
getService().getOption(CONFIG_FILENAME_LOCATION);
try {
if (filename == null) {
String servletLocation = (String) msgc.
getProperty(HTTPConstants.MC_HTTP_SERVLETLOCATION);
filename = servletLocation + "\\" + CONFIG_FILENAME;
is = new FileInputStream(filename);
} else {
is = new FileInputStream(filename);
}
} catch (FileNotFoundException e) {
log.info("File " + filename + " not found");
is = null;
}
//Process the config file
process(is);
} catch (Exception e) {
//TBD: MethodCaller needs configuration
caller = new MethodCaller();
log.error(e);
}
}
My deployment file looks like this:
<service name="MessageService" provider="java:MSG" >
<parameter name="className" value="si.hermes.MessageService"/>
<parameter name="allowedMethods" value="entryPoint"/>
<parameter name="scope" value="application"/>
<parameter name="configFile" value="c:\conf\my_config_file.xml"/>
</service>
Hope this helps. Ramon.
-----Original Message-----
From: Schuring, Tom [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 14, 2002 6:07 AM
To: [EMAIL PROTECTED]
Subject: initial config information
hello,
how would i pass initial config information to a webservice in axis ?
for example: "the path and filename of a logfile"
any hints are welcome.
thanks,
tom