first advice leave the 'static' notion.
this do not give you a lot.
in the following example, you will have a single static instance (singleton)
of your WebService.

I would do :

public class WebService() {
 private A a;
 private B b;
 public WebService() {
   this.a = new A();
   this.b = new B();
 }
 public void execA1(String a) {this.a.execA1(a);}
 public void execA2(String a) {this.a.execA2(a);}
 public void execB1(String a) {this.b.execB1(a);}
 public void execB2(String a) {this.b.execB2(a);}
}

public class A() {
 public  void execA1(String a) {..}
 public  void execA2(String a) {..}
}

public class B() {
 public  void execB1(String a) {..}
 public  void execB2(String a) {..}
}



On Fri, Feb 26, 2010 at 9:38 AM, Vincent FINET <[email protected]> wrote:

> Your approach is pretty much like a "remote object instance" approach (like
> CORBA for instance).
>
> Web service are slightly different.
>
> In your example, you ask your server to give you an instance of class A or
> B (depending if you call getA or getB)
>
> Since you got your instance of A or B, if you call a function (execA1, 
> execA2, execB1,
> ...) you
> call a local function and not a remote fonction.
>
> When you have this in mind, you might reorder your sequence.
>
> Best regards,
> Vincent FINET
>
> On Thu, Feb 25, 2010 at 6:00 PM, jamie <[email protected]> wrote:
>
>> Hi There
>>
>> I am an Axis newbie,  trying to design a web service API for a server
>> product. When using the Axis2 Code Generator plugin, I find it extremely
>> easy to generate a web service using a single class, but I am baffled as to
>> how to construct an entire API with multiple classes. Since my API is large,
>> I'd like to group functions into multiple classes. In other words, assuming
>> I have:
>>
>>
>> public class WebService() {
>>
>>  public static void execA1(String a) {..}
>>  public static void execA2(String a) {..}
>>  public static void execB1(String a) {..}
>>  public static void execB2(String a) {..}
>>
>> }
>>
>> I'd like to  have:
>>
>> public class WebService() {
>>      public static A getA() { return new A(): }
>>      public static B getB() { return new B(); }
>> }
>>
>> public class A() {
>>  public  void execA1(String a) {..}
>>  public  void execA2(String a) {..}
>>  }
>>
>>  public class B() {
>>  public  void execB1(String a) {..}
>>  public  void execB2(String a) {..}
>>  }
>>
>> Obviously, the above does not work, unless execB1,etc. are getters and
>> setters.
>>
>> How do I code it such that the Axis client code can access different
>> classes and call "static" methods on those objects.
>> Bear in mind that I'd like to have one login session across all classes.
>>
>>  My sincere apologies if this is obvious.
>>  Thanks in advance
>>
>> Jamie
>>
>>
>
>

Reply via email to