Hello,

I am new to Axis and am hoping to get some advice on how to dynamically add
services on the server. 

Here is our situation:

1. We are building a web services front-end to a proprietary scripting
system where the definitions of various functions (400+) are stored in
database tables
2. The database tables specify the name of the function, the number and data
type of the arguments, the type of the return value, etc.
3. The function definitions are in the database because they are updated
from time-to-time
4. We want each of these functions to be published as an Axis web service
5. In addition to these dynamic services, we have a couple of static
services that won't change

Here is what we have tried so far:

1. We defined the static services the normal way
2. We created our own EngineConfigurationFactory that essentially wraps the
FileProvider that the EngineConfigurationFactoryServlet provides
3. During the call to EngineConfiguration.configureEngine() in the wrapper
class we get the existing Deployment (that has our already defined static
services) and just try to add our dynamic services there. Here is our test
code:

  public void configureEngine(AxisEngine axisEngine) throws
ConfigurationException {
    ...
    fileProvider.configureEngine(axisEngine);
    WSDDDeployment deployment = fileProvider.getDeployment();
    ...
    for(int i=0; i<functionNames.length; i++) {
      WSDDService service = new WSDDService();
      service.setParameter("allowedMethods", "invoke");
      service.setParameter("className",
"com.myproject.service.ScriptFunction");
      service.setProviderQName(new QName("java:RPC"));
      service.setQName(new QName("urn:" + functionNames[i]));
      deployment.deployService(service);
    }
    fileProvider.writeEngineConfig(axisEngine);
  }

4. Unfortunately, this does not really work. I can see the service entries
in server-config.wsdd, but the server complains when I try to invoke one of
them. That is, the client gets back 'The AXIS engine could not find a target
service to invoke! targetService is null'.  

5. The odd thing is, if I restart the server with the code above commented
out, it reads the server-config.wsdd entry and the service is there OK.  So,
not only does this code prevent services from being available, it also seems
to break an otherwise properly deployed service.

Here are my questions:

1. What are we doing wrong? Is there an easier/better way to accomplish
this?
2. Even if this approach did work, we still have another problem. How to
programmatically specify the details (function name, argument types, etc.)
without a Java class?  Obviously the generic class
com.myproject.service.ScriptFunction in our test code would make every
function look the same except for the name.

I realize this may be somewhat of an advanced issue, but I am hoping someone
has experience with something like it or can point me to some documentation
or examples.

Thanks in advance for any help.

Marc


Reply via email to