jeudi 6 août 2015

How to create a wrapper to distinguish between 2 or more standalone web service applications

I have 2 projects in my Eclipse which are actually two standalone webservice(publishes SOAP) applications. Usually I will create 2 JAR files from the 2 projects and I used to run to publish the services. Both applications have the same methods. Now I have to provide a wrapper on top of those two services provided with a variable to distinguish between the services.

If I try to access a method by passing a variable it should call the appropriate class's implementation.

in the below example, I'm passing animal as an integer. if the animal is 1 Cat class method should be called, if 2 then Dog class method has to respond.

Wrapper wrap = new Wrapper();
wrap.makeNoise(int animal);   // 1=Bow-Bow, 2=Meow-Meow

Below are the two different Webservice application publishing SOAP

class Cat(){
 public void makeNoise(){
  System.out.println("Meow-Meow");
 }
}

Cat.java

class Dog(){
 public void makeNoise(){
  System.out.println("Bow-Bow");
 }
}

Dog.java

Please suggest me how to implement this requirement

Aucun commentaire:

Enregistrer un commentaire