The current code has a "configure" sample with the following deployment descriptor:

<isd:service id="urn:configure-sample">
 <isd:provider type="java" scope="Application" methods="getConfigureParameters">
  <isd:java class="samples.configure.ConfigureService"/>
  <isd:option key="option1" value="you can configure your service"/>
  <isd:option key="option2" value="through your deployment descriptor"/>
 </isd:provider>
 <isd:faultListener>org.apache.soap.server.DOMFaultListener</isd:faultListener>
</isd:service>

The "option" tags are the information contained in one of the Hashtables passed to the 
configure method.  You would do, for example,

  <isd:option key="filename" value="/usr/local/etc/myservice/myservice.txt"/>

Then have a configure method like
 
  public void configure(Hashtable serviceParameters,
                        Hashtable servletParameters,
                        Hashtable contextParameters) throws Exception {
    String filename = contextParameters.get("filename");
    // open/read/close
  }

Scott Nichol

Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.
----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 17, 2004 11:24 AM
Subject: Asunto: Re: accesing data


Scott,

Your summary is right. I need to access the name of the text file from the
constructor, or, alternatively, the data itself.

So, as you say, I could do that implementing the ConfigurableService interface.
But, how can I put the name of the file (or the data itself) in the deployment
descriptor? or do I have to put it in another place?

Thanks very much,

Tizo


>-- Mensaje original --
>Reply-To: [EMAIL PROTECTED]
>From: "Scott Nichol" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Subject: Re: accesing data
>Date: Tue, 17 Feb 2004 10:41:40 -0500
>
>
>My summary: you want to access a text file from the constructor for your
>service class, and you are wondering how you can put the name of the file
>in configuration data the can be accessed from the constructor.  Is that
>right?
>
>Nothing is provided in the Apache SOAP framework to help you do exactly
what
>I have stated above.  In all versions, you would have the alternative of
>having an initialization method called from each of your methods, i.e.
lazy
>initialization.  Your methods would each have the SOAPContext parameter
for
>you to access the deployment descriptor or servlet initialization information.
>
>Added to the current code after the 2.3.1 release, your service class can
>also implement the ConfigurableService interface.  The configure method
on
>this interface is called once per instance of the service, immediately
after
>the constructor.  This method receives webapp, servlet and deployment descriptor
>initialization values in Hashtables.  With post-2.3.1 code, this is the
preferred
>method for initializing services.
>
>Scott Nichol
>
>Do not send e-mail directly to this e-mail address,
>because it is filtered to accept only mail from
>specific mail lists.
>----- Original Message ----- 
>From: <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Saturday, February 14, 2004 6:41 PM
>Subject: accesing data
>
>
>Hi,
>
>I am implementing a service with SOAP RPC (with application scope), and
>I would like to know how can I access a text file from it. I have read
from
>the list, that there is a way to do that putting the data in the deploymenent
>descriptor, and then accessing it with SOAPContext, but I need the data
>in the constructor of the service. How could I do that? I had though in
>an environment variable too, but it's not portable, and Java don't allow
>to read them.
>
>Thanks very much,
>
>Tizo
>
>

Reply via email to