AXIS is a servlet, so you should be able to read from the web.xml .
Example:
java.util.Hashtable MyServletParams= new java.util.Hashtable();
private void InitializeParams()
{
ServletContext sc = getServletConfig().getServletContext();
java.util.Enumeration e = sc.getInitParameterNames();
while (e.hasMoreElements()) {
String name = (String)e.nextElement();
MyServletParams.put(name, sc.getInitParameter(name));
}
}
Then in web.xml:
<context-param>
<param-name>DbDriverClassName</param-name>
<param-value>net.sourceforge.jtds.jdbc.Driver</param-value>
</context-param>
<context-param>
<param-name>DbUrl</param-name>
<param-value>jdbc:jtds:sqlserver://hostname:1433/Northwind;tds=8.0;lastupdatecount=true</param-value>
</context-param>
<context-param>
<param-name>DbUser</param-name>
<param-value>NoNoNo</param-value>
</context-param>
<context-param>
<param-name>DbPassword</param-name>
<param-value>Secret</param-value>
</context-param>
But I think there are better ways to do this, in servlets. Like configuring a
resource or something for the JDBC connection. I recall Elaine Nance mentioned
this a little bit ago. So you wouldn't do the old style of reading the params,
then doing Class.forName() to load the JDBC driver. This can be done by the
container, for you.
In theory.
-----Original Message-----
From: Willy Dob� [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 30, 2005 10:37 AM
To: [email protected]
Subject: End user service configuration via deployment descriptor
Hello friends,
stand alone JAVA programs usually come with a configuration file that allows
the end user to tweak program's behavior. For example: programs that use
databases need connectivity parameters such as database URL, user, password, ...
When having a web service instead of a simple JAVA program I thought the
deployment descriptor would be the right place to add configuration params but
I have no idea how to read the parameters' values from my service
implementation.
Example: Class CustomerDatabase implements a web service that grants access to
the corporate customer database over JDBC. Thus, CustomerDatabase needs to read
connectivity params configured in this deployment descriptor:
<deployment ...>
<service name="CustomerDatabase" ...>
<parameter name="dbUrl" value="jdbc:odbc:customerdb"/>
<parameter name="dbUser" value="CustomerDatabaseService"/>
<parameter name="dbPassword" value="secret"/>
...
<parameter name="className" value="package.CustomerService"/>
<parameter name="allowedMethods" value="*"/>
...
</service>
</deployment>
Which class of the AXIS framework allows to access this information?
Which methods do so?
Thanks for help
Willy