You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Jesse D. Sightler" <js...@eximtechnologies.com> on 2002/06/24 18:26:27 UTC

Configuring a web service...

Is there any way in the current Axis system (nightly builds) to pass
configuration parameters to a Web Service?

I need to pass some filesystem path information which would normally be
passed using init-params to servlets, but I'm unsure how to do a similar
thing with Axis.

What are my options?

Thanks,
-- 
=======================================
Jess Sightler
Programmer
Exim Technologies
131 Falls Street
Greenville SC 29601
Phone: 864-679-4651
=======================================



Re: Configuring a web service...

Posted by Andrew Vardeman <an...@iastate.edu>.
Jess,

one option is to include a normal servlet in your Axis webapp.  Set it to 
load at startup, read init-params, and hang whatever variables you need in 
the ServletContext.  This isn't "pure" Axis, but it works.  You can get at 
the ServletContext like this:

MessageContext msgC = MessageContext.getCurrentContext();
ServletContext sc = 
((HttpServlet)msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLET)).getServletContext();

Andrew

At 12:26 PM 6/24/2002 -0400, you wrote:
>Is there any way in the current Axis system (nightly builds) to pass
>configuration parameters to a Web Service?
>
>I need to pass some filesystem path information which would normally be
>passed using init-params to servlets, but I'm unsure how to do a similar
>thing with Axis.
>
>What are my options?
>
>Thanks,
>--
>=======================================
>Jess Sightler
>Programmer
>Exim Technologies
>131 Falls Street
>Greenville SC 29601
>Phone: 864-679-4651
>=======================================




Re: Configuring a web service...

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Jesse D. Sightler" <js...@eximtechnologies.com>
To: <ax...@xml.apache.org>
Sent: Monday, June 24, 2002 11:04 AM
Subject: Re: Configuring a web service...


> Hi Steve,
>
> This is the best suggestion that I've seen so far, and is probably what
> I will go with (although, I will probably just place the config file in
> the WEB-INF directory of the web-app for now).

WEB-INF/classes is good; you can load it as a resource.

>
> Thanks for all of the ideas.  It would be nice if Apace Axis provided a
> more standardized way of doing this, but it seems the config-file
> approach is relatively "pure".
>

XML config files are purer.

I actually have used a two level config setup in the past; a hostname config
can point to a cluster config; off the cluster config comes all the settings
shared by >1 box in a cluster, including log4J settings, security policies
(who can call your endpoints), etc.

It works provided that ops gave you all the right config info from the
beginning. But if you do need to change a setting on a cluster, you need to
edit every box in turn. Hence the plan to move LDAP/JNDI


Re: Configuring a web service...

Posted by "Jesse D. Sightler" <js...@eximtechnologies.com>.
Hi Steve,

This is the best suggestion that I've seen so far, and is probably what
I will go with (although, I will probably just place the config file in
the WEB-INF directory of the web-app for now).

Thanks for all of the ideas.  It would be nice if Apace Axis provided a
more standardized way of doing this, but it seems the config-file
approach is relatively "pure".

Thanks again,
-- 
=======================================
Jess Sightler
Programmer
Exim Technologies
131 Falls Street
Greenville SC 29601
Phone: 864-679-4651
=======================================



On Mon, 2002-06-24 at 13:54, Steve Loughran wrote:
> The way I configure all my apps right now is
> 
> 
> -configurable objects take a Configurable interface in constructor; this has
> a few getProperty methods and a getSubConfiguration(String name) method that
> returns a sub config
> 
> -this is mapped to an XML config file, though I could swap it for JNDI or
> something in future
> 
> -I have a different XML file for every host, driven off hostname
> 
> -when my app starts, it gets its hostname and pulls in the config file.
> 
> 
> this lets me get away with tunable configs for different boxes from a single
> WAR file. The JNDI option will let me move to a clustered approach as and
> when necessary.



Re: Configuring a web service...

Posted by Steve Loughran <st...@iseran.com>.
The way I configure all my apps right now is


-configurable objects take a Configurable interface in constructor; this has
a few getProperty methods and a getSubConfiguration(String name) method that
returns a sub config

-this is mapped to an XML config file, though I could swap it for JNDI or
something in future

-I have a different XML file for every host, driven off hostname

-when my app starts, it gets its hostname and pulls in the config file.


this lets me get away with tunable configs for different boxes from a single
WAR file. The JNDI option will let me move to a clustered approach as and
when necessary.


Re: Configuring a web service...

Posted by Jürgen Kaatz <ka...@e-commerceit.de>.
Hi Jess,

you can put the variables in the copnfigureation file of your application 
server.
I use tomcat (and for that server.xml):

<Context path="/axis" docBase="axis" debug="1" privileged="false" 
reloadable="true">
<Environment name="foo" value="bar" type="java.lang.String" override="false"/>
</Context>

In your code you can use:

Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:/comp/env");
String retVal = (DataSource) envCtx.lookup("foo");

The advantage is, that all configuration can be done by deploying the web 
service.
Juergen

>Is there any way in the current Axis system (nightly builds) to pass
>configuration parameters to a Web Service?
>
>I need to pass some filesystem path information which would normally be
>passed using init-params to servlets, but I'm unsure how to do a similar
>thing with Axis.

-----------------------------
Juergen Kaatz
Entwickler / Developer
WWE e-commerce IT GmbH
Eiffestrasse 462
20537 Hamburg
URL: http://www.e-commerceit.de/
URL: http://www.iets.de/ (Internet Export Trading System)
Tel: +49-40-2530659-32
Fax: +49-40-2530659-50
Tel. +49-40-2530659-0 (Zentrale)
E-Mail : kaatz@wwe.biz