New in version 2.1 is a SOAP server configuration file. By default the server will look in the current directory for a file called "soap.xml". If a different file is to be used, this can be changed by specifying a parameter that the transport listener (ie. RPCRouter Servlet) passes along to the SOAP server during startup. The transport listener should call the static setConfigFilename() method on the ServiceManager object before invoking the SOAP server:
<servlet> <servlet-name>rpcrouter</servlet-name> <display-name>Apache-SOAP RPC Router</display-name> <description>no description</description> <servlet-class> org.apache.soap.server.http.RPCRouterServlet </servlet-class> <init-param> <param-name>faultListener</param-name> <param-value>org.apache.soap.server.DOMFaultListener</param-value> </init-param> <font color="blue"> <init-param> <param-name>ConfigFile</param-name> <param-value>d:\soap\mysoap.xml</param-value> </init-param> </font> </servlet>
Currently, only one setting can be specified in this file: the pluggable configuration manager to use. By default the DefaultConfigManager class is used. When services are deployed and undeloyed this class will save list of deployed services to a file called DeployedServices.ds in the current directory. As an option in the configuration file, you can change the location of this file by using the "filename" option:
<!-- Sample Apache SOAP Server Configuration File --> <soapServer> <!-- This section defines the same thing you get if you don't --> <!-- specify anything at all - aka the default --> <configManager value="org.apache.soap.server.DefaultConfigManager" > <option name="filename" value="d:\soap\mylist.ds" /> </configManager> </soapServer>As state before, if no configuration file is found, or if no configuration manager is specified in the file configuration file that is found, then the DefaultConfigManager class will be used. And the DeployedServices.ds file in the current directory will be used to save the list of deployed services.
Simply stated, a configuration manager is responsible for saving the current list of deployed services so that when the soap server is restarted the services will not need to be redeployed again. Configuration managers implement the ConfigManager interface:
public interface ConfigManager { public void setOptions(Hashtable options) throws SOAPException ; public void init() throws SOAPException ; public void deploy(DeploymentDescriptor dd) throws SOAPException ; public String[] list() throws SOAPException ; public DeploymentDescriptor undeploy(String id) throws SOAPException ; public DeploymentDescriptor query(String id) throws SOAPException ; }The methods:
void setOptions(Hashtable options) throws SOAPException
This method will be called with a Hasbtable of name/value pairs that were specified in the configuration file. In the event of an error a SOAPException should be thrown.
void init() throws SOAPException
This method will be called after the ConfigManager object is created, allowing any initializion to be done. For example, reading the DeployedServices.ds file. In the event of an error a SOAPException should be thrown.
void deploy(DeploymentDescriptor dd) throws SOAPException
This method will be called when a service is deployed (or redeployed). The service should be added to whatever internal data structure is used to store the list of services and that list should be persisted so that if the server is stopped the list can be reloaded upon startup. In the event of an error a SOAPException should be thrown.
String[] list() throws SOAPException
This method should return an array of String objects, one for each deployed service. In the event of an error a SOAPException should be thrown.
DeploymentDescriptor undeploy(String id) throws SOAPException
This method will be called when a service is undeployed. The should should be removed from whatever internal data structure is used to store the list and that list should be persisted so that if the server is stopped the list can be reloaded upon startup. In the event of an error a SOAPException should be thrown.
A user-defined configuration manager may be used by specifying the classname in the SOAP configuration file:DeploymentDescriptor query(String id)throws SOAPException
This method should return a DeploymentDescriptor object representing the metadata about a service. In the event of an error a SOAPException should be thrown.
<!-- Sample Apache SOAP Server Configuration File --> <soapServer> <!-- This section defines the same thing you get if you don't --> <!-- specify anything at all - aka the default --> <configManager value="org.mycom.MyMgr" > <option name="myopt1" value="myval1" /> </configManager> </soapServer>