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 Joachim Flammer <Jo...@cern.ch> on 2005/05/23 15:15:34 UTC

Newbie question: combining two services interfaces

Hi,

Being a newbie to axis is not good to start with a complex problem - but
sometimes you have to :). Maybe someone can give me a hint or point me
to an example.

Here is my problem:

I have several services (ServiceA, ServiceB, ...) running inside tomcat
that should share some common "management" interfaces/service. For each
of the services, I want to be able to contact the service methods as
well as the methods of the (individual) management interface for the
service, e.g.

	myPath/serviceA/getResult?num=2     	to contact the service
interface
and	
	myPath/serviceA/getVersion       
or	myPath/serviceA/management/getVersion     to contact the
management interface and
get the version of service A 

I have one Service A implemented in ServiceA.java that uses the
ManagementService for common functionality:

class ServiceA implements interfaceA {

  String serviceName = "ServiceA";

  ManagementService centralService;

  public void ServiceA(){

    centralService = new CentralService(serviceName);
  }

  public int getHello(int num){ return 2*num};
}

and the management service (for each service) implemented in
ManagementService.java as a singleton, like

class ManagementService implements managementInterface {

	String myVersion;

	// singleton
	static private ManagementService _instance = null;

	static public ManagementService instance(String serviceName) {
		if (null == _instance) {
			_instance = new ManagementService();
			_instance.init(serviceName);
		}
		return _instance;
	}

	public void init(String serviceName){

	   // .... init the class ... e.g. load the version number

	   // assign version number
	   myVersion ="1.2.3";
	}

	public String getVersion() { return myVersion; }
}

Now one way I guess would be to rather inheret ServiceA from
ManagementService to incoporate both interfaces but this is
unfortunately not possible due to project constraints.

Is there a way for axis to use functions like "getResult" from the class
ServiceA and 
"getVersion" from the ServiceA instance of ManagementService?

Is this specified in the axis configuration file and how?

Thanks a lot in advance for any help,

   Cheers,

    Joachim