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 jamie <ja...@fastmail.fm> on 2010/02/25 18:00:48 UTC

Multiple classes

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

Re: Multiple classes

Posted by jamie <ja...@fastmail.fm>.
>From what I can tell this is not possible. You need to create
multiple service classes within a service group. Apparently,
though I have not confirmed, session state is shared across
multiple groups.

On Thu, 25 Feb 2010 19:00 +0200, "jamie" <ja...@fastmail.fm>
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

Re: Multiple classes

Posted by Amila Suriarachchi <am...@gmail.com>.
On Fri, Feb 26, 2010 at 5:46 PM, jamie <ja...@fastmail.fm> wrote:

>  Hi Everyone
>
> Thanks for your suggestions regarding multiple classes. I've decided to use
> multiple web services for each section of the API, however, I cannot get
> services within the servicegroup to
> share properties.
>
> In the Test web service that controls the login. Once the user has logged
> in successfully, I call the newSession object that sets the
> Config object to a property.
>
> private void newSession() throws AxisFault {
>         if(mc!=null) {
>               ServiceGroupContext sgc = mc.getServiceGroupContext();
>               if (sgc != null) {
>                   sgc.setProperty("config", config);
>               }
>         }
>  }
>
> In the services.xml, I set the scope of each of the services to
> "transportsession":
>
> <service name="Test2" scope="transportsession">
>     <Description>
>         MailArchiva search API
>     </Description>
>     <messageReceivers>
>         <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
> class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
>         <messageReceiver  mep="http://www.w3.org/2004/08/wsdl/in-out"
> class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
>     </messageReceivers>
>     <parameter name="ServiceClass"
> locked="false">com.test.Test2</parameter>
> </service>
>
> <service name="Test1" scope="transportsession">
>     <Description>
>       Test API
>     </Description>
>     <messageReceivers>
>         <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
> class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
>         <messageReceiver  mep="http://www.w3.org/2004/08/wsdl/in-out"
> class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
>     </messageReceivers>
>     <parameter name="ServiceClass"
> locked="false">com.test.Test1</parameter>
> </service>
>
> In the Test2 service implementation, I have a getConfig() object which is
> called by each of the methods to set the internal application configuration
> object
>
>
>     private Config getConfig() throws AxisFault {
>         MessageContext mc = MessageContext.getCurrentMessageContext();
>         if(mc.getServiceGroupContext()!=null) {
>              Config config =
> (Config)mc.getServiceGroupContext().getProperty("config");
>              if (config!=null) {
>                  return config;
>              }
>         }
>         throw new AxisFault("not logged in");
>     }
>
>
> When the web service client calls the above, getProperty("config") always
> returns null. Thus,
> there is no sharing taking place.
>
> In the web service client, I do the following:
>
> test1Stub = new Test1Stub(url+"/MailArchiva");
> test1Stub._getServiceClient().getOptions().setManageSession(true);
>

do you invoke Test2 using test2Stub?
in that case the cookie information may not send with the second request.
you can confirm this by sending messages from a tcpmon[1].
if it is the case try this[2] you need to manually copy the cookie details
as given there.
this[3] may also help you to understand how Axis2 handle scopes.

Regarding using multiple classes you have no option other than publishing
every class as a separate service.

thanks,
Amila.

[1] http://ws.apache.org/commons/tcpmon/
[2]
http://amilachinthaka.blogspot.com/2009/02/accessing-wso2-products-back-end.html
[3] https://www.wso2.org/library/articles/stateful-web-services-axis2

>
> Am I missing something important here? Anyone know why the session is not
> applied across all servicegroups?
>
> Thanks
>
> Jamie
>
>



-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

AW: Multiple classes

Posted by Stadelmann Josef <jo...@axa-winterthur.ch>.
I confirm - scope="SOAPSESSION" in conjunction with Service Groups
allows to identify the same instance of an object using it's
ServicegroupdID

 

We uses to map a users-clients-thread to reach always the same
per-session-thread-object which is a place-holder to communicate by IPC
with a per session-thread legacy-system-process.

 

And we have long lasting user/client-session-threads, and each user can
have up to a maximum allowed long-lasting-user-sessions-threads which
reach each it's own Open-VMS-legacy-system-process.

 

Josef.Stadelmann

@axa-winterthur.ch

 

 

Von: David Hesson [mailto:dhesson@rjlg.com] 
Gesendet: Freitag, 26. Februar 2010 14:18
An: java-user@axis.apache.org
Betreff: RE: Multiple classes

 

Maybe try "soapsession" instead of "transportsession"

 

Seems like transport session should work though.

 

Have a look here:
http://wso2.org/library/articles/axis2-session-management-part-2
<http://wso2.org/library/articles/axis2-session-management-part-2> 

 

________________________________

From: jamie [mailto:jamieb@fastmail.fm]
Sent: Fri 2/26/2010 7:16 AM
To: Vincent FINET
Cc: java-user@axis.apache.org
Subject: Re: Multiple classes

Hi Everyone

 

Thanks for your suggestions regarding multiple classes. I've decided to
use multiple web services for each section of the API, however, I cannot
get services within the servicegroup to 

share properties.  

 

In the Test web service that controls the login. Once the user has
logged in successfully, I call the newSession object that sets the

Config object to a property.

 

private void newSession() throws AxisFault {
        if(mc!=null) {
              ServiceGroupContext sgc = mc.getServiceGroupContext();
              if (sgc != null) {
                  sgc.setProperty("config", config);
              }
        }
 }

 

In the services.xml, I set the scope of each of the services to
"transportsession":

 

<service name="Test2" scope="transportsession">
    <Description>
        MailArchiva search API
    </Description>
    <messageReceivers>
        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
        <messageReceiver  mep="http://www.w3.org/2004/08/wsdl/in-out"
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
    </messageReceivers>
    <parameter name="ServiceClass"
locked="false">com.test.Test2</parameter>
</service>


<service name="Test1" scope="transportsession">
    <Description>
      Test API
    </Description>
    <messageReceivers>
        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
        <messageReceiver  mep="http://www.w3.org/2004/08/wsdl/in-out"
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
    </messageReceivers>
    <parameter name="ServiceClass"
locked="false">com.test.Test1</parameter>
</service>

 

In the Test2 service implementation, I have a getConfig() object which
is called by each of the methods to set the internal application
configuration object

 


    private Config getConfig() throws AxisFault {
        MessageContext mc = MessageContext.getCurrentMessageContext();
        if(mc.getServiceGroupContext()!=null) {
             Config config =
(Config)mc.getServiceGroupContext().getProperty("config");
             if (config!=null) {
                 return config;
             }
        }
        throw new AxisFault("not logged in");
    }
 

 

When the web service client calls the above, getProperty("config")
always returns null. Thus, 

there is no sharing taking place.

 

In the web service client, I do the following:

 

test1Stub = new Test1Stub(url+"/MailArchiva");
test1Stub._getServiceClient().getOptions().setManageSession(true);

 

Am I missing something important here? Anyone know why the session is
not applied across all servicegroups?

 

Thanks

 

Jamie

 


RE: Multiple classes

Posted by David Hesson <dh...@rjlg.com>.
Maybe try "soapsession" instead of "transportsession"
 
Seems like transport session should work though.
 
Have a look here:  http://wso2.org/library/articles/axis2-session-management-part-2 <http://wso2.org/library/articles/axis2-session-management-part-2> 

________________________________

From: jamie [mailto:jamieb@fastmail.fm]
Sent: Fri 2/26/2010 7:16 AM
To: Vincent FINET
Cc: java-user@axis.apache.org
Subject: Re: Multiple classes


Hi Everyone
 
Thanks for your suggestions regarding multiple classes. I've decided to use multiple web services for each section of the API, however, I cannot get services within the servicegroup to 
share properties.  
 
In the Test web service that controls the login. Once the user has logged in successfully, I call the newSession object that sets the
Config object to a property.
 
private void newSession() throws AxisFault {
        if(mc!=null) {
              ServiceGroupContext sgc = mc.getServiceGroupContext();
              if (sgc != null) {
                  sgc.setProperty("config", config);
              }
        }
 }
 
In the services.xml, I set the scope of each of the services to "transportsession":
 
<service name="Test2" scope="transportsession">
    <Description>
        MailArchiva search API
    </Description>
    <messageReceivers>
        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
        <messageReceiver  mep="http://www.w3.org/2004/08/wsdl/in-out"  class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
    </messageReceivers>
    <parameter name="ServiceClass" locked="false">com.test.Test2</parameter>
</service>

<service name="Test1" scope="transportsession">
    <Description>
      Test API
    </Description>
    <messageReceivers>
        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
        <messageReceiver  mep="http://www.w3.org/2004/08/wsdl/in-out"  class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
    </messageReceivers>
    <parameter name="ServiceClass" locked="false">com.test.Test1</parameter>
</service>
 
In the Test2 service implementation, I have a getConfig() object which is called by each of the methods to set the internal application configuration object
 

    private Config getConfig() throws AxisFault {
        MessageContext mc = MessageContext.getCurrentMessageContext();
        if(mc.getServiceGroupContext()!=null) {
             Config config = (Config)mc.getServiceGroupContext().getProperty("config");
             if (config!=null) {
                 return config;
             }
        }
        throw new AxisFault("not logged in");
    }
 
 
When the web service client calls the above, getProperty("config") always returns null. Thus, 
there is no sharing taking place.
 
In the web service client, I do the following:
 
test1Stub = new Test1Stub(url+"/MailArchiva");
test1Stub._getServiceClient().getOptions().setManageSession(true);
 
Am I missing something important here? Anyone know why the session is not applied across all servicegroups?
 
Thanks
 
Jamie
 

Re: Multiple classes

Posted by jamie <ja...@fastmail.fm>.
The docs do say that you can create Web services sessions and
share them across Web services, but they are vague on how exactly
you do this.  I am not sure how a simple requirement to split up
an API into logical parts, results in a lengthy indepth technical
exploration of poorly documented Axis antics. Perhaps, I am going
down the wrong path?

On Fri, 26 Feb 2010 13:48 +0100, "Vincent FINET"
<vf...@sqli.com> wrote:

  According to my experience Web Service are stateless.

On Fri, Feb 26, 2010 at 1:16 PM, jamie <[1...@fastmail.fm>
wrote:

Hi Everyone

Thanks for your suggestions regarding multiple classes. I've
decided to use multiple web services for each section of the API,
however, I cannot get services within the servicegroup to
share properties.

In the Test web service that controls the login. Once the user
has logged in successfully, I call the newSession object that
sets the
Config object to a property.

private void newSession() throws AxisFault {
        if(mc!=null) {
              ServiceGroupContext sgc =
mc.getServiceGroupContext();
              if (sgc != null) {
                  sgc.setProperty("config", config);
              }
        }
 }

In the services.xml, I set the scope of each of the services to
"transportsession":

<service name="Test2" scope="transportsession">
    <Description>
        MailArchiva search API
    </Description>
    <messageReceivers>
        <messageReceiver
mep="[2]http://www.w3.org/2004/08/wsdl/in-only"
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"
/>
        <messageReceiver
mep="[3]http://www.w3.org/2004/08/wsdl/in-out"
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
    </messageReceivers>
    <parameter name="ServiceClass"
locked="false">com.test.Test2</parameter>
</service>
<service name="Test1" scope="transportsession">
    <Description>
      Test API
    </Description>
    <messageReceivers>
        <messageReceiver
mep="[4]http://www.w3.org/2004/08/wsdl/in-only"
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"
/>
        <messageReceiver
mep="[5]http://www.w3.org/2004/08/wsdl/in-out"
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
    </messageReceivers>
    <parameter name="ServiceClass"
locked="false">com.test.Test1</parameter>
</service>

In the Test2 service implementation, I have a getConfig() object
which is called by each of the methods to set the internal
application configuration object

    private Config getConfig() throws AxisFault {
        MessageContext mc =
MessageContext.getCurrentMessageContext();
        if(mc.getServiceGroupContext()!=null) {
             Config config =
(Config)mc.getServiceGroupContext().getProperty("config");
             if (config!=null) {
                 return config;
             }
        }
        throw new AxisFault("not logged in");
    }


When the web service client calls the above,
getProperty("config") always returns null. Thus,
there is no sharing taking place.

In the web service client, I do the following:

test1Stub = new Test1Stub(url+"/MailArchiva");
test1Stub._getServiceClient().getOptions().setManageSession(true)
;

Am I missing something important here? Anyone know why the
session is not applied across all servicegroups?

Thanks

Jamie

References

1. mailto:jamieb@fastmail.fm
2. http://www.w3.org/2004/08/wsdl/in-only
3. http://www.w3.org/2004/08/wsdl/in-out
4. http://www.w3.org/2004/08/wsdl/in-only
5. http://www.w3.org/2004/08/wsdl/in-out

Re: Multiple classes

Posted by Vincent FINET <vf...@sqli.com>.
According to my experience Web Service are stateless.


On Fri, Feb 26, 2010 at 1:16 PM, jamie <ja...@fastmail.fm> wrote:

>  Hi Everyone
>
> Thanks for your suggestions regarding multiple classes. I've decided to use
> multiple web services for each section of the API, however, I cannot get
> services within the servicegroup to
> share properties.
>
> In the Test web service that controls the login. Once the user has logged
> in successfully, I call the newSession object that sets the
> Config object to a property.
>
> private void newSession() throws AxisFault {
>         if(mc!=null) {
>               ServiceGroupContext sgc = mc.getServiceGroupContext();
>               if (sgc != null) {
>                   sgc.setProperty("config", config);
>               }
>         }
>  }
>
> In the services.xml, I set the scope of each of the services to
> "transportsession":
>
> <service name="Test2" scope="transportsession">
>     <Description>
>         MailArchiva search API
>     </Description>
>     <messageReceivers>
>         <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
> class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
>         <messageReceiver  mep="http://www.w3.org/2004/08/wsdl/in-out"
> class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
>     </messageReceivers>
>     <parameter name="ServiceClass"
> locked="false">com.test.Test2</parameter>
> </service>
>
> <service name="Test1" scope="transportsession">
>     <Description>
>       Test API
>     </Description>
>     <messageReceivers>
>         <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
> class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
>         <messageReceiver  mep="http://www.w3.org/2004/08/wsdl/in-out"
> class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
>     </messageReceivers>
>     <parameter name="ServiceClass"
> locked="false">com.test.Test1</parameter>
> </service>
>
> In the Test2 service implementation, I have a getConfig() object which is
> called by each of the methods to set the internal application configuration
> object
>
>
>     private Config getConfig() throws AxisFault {
>         MessageContext mc = MessageContext.getCurrentMessageContext();
>         if(mc.getServiceGroupContext()!=null) {
>              Config config =
> (Config)mc.getServiceGroupContext().getProperty("config");
>              if (config!=null) {
>                  return config;
>              }
>         }
>         throw new AxisFault("not logged in");
>     }
>
>
> When the web service client calls the above, getProperty("config") always
> returns null. Thus,
> there is no sharing taking place.
>
> In the web service client, I do the following:
>
> test1Stub = new Test1Stub(url+"/MailArchiva");
> test1Stub._getServiceClient().getOptions().setManageSession(true);
>
> Am I missing something important here? Anyone know why the session is not
> applied across all servicegroups?
>
> Thanks
>
> Jamie
>
>

Re: Multiple classes

Posted by jamie <ja...@fastmail.fm>.
Hi Everyone

Thanks for your suggestions regarding multiple classes. I've
decided to use multiple web services for each section of the API,
however, I cannot get services within the servicegroup to
share properties.

In the Test web service that controls the login. Once the user
has logged in successfully, I call the newSession object that
sets the
Config object to a property.

private void newSession() throws AxisFault {
        if(mc!=null) {
              ServiceGroupContext sgc =
mc.getServiceGroupContext();
              if (sgc != null) {
                  sgc.setProperty("config", config);
              }
        }
 }

In the services.xml, I set the scope of each of the services to
"transportsession":

<service name="Test2" scope="transportsession">
    <Description>
        MailArchiva search API
    </Description>
    <messageReceivers>
        <messageReceiver
mep="http://www.w3.org/2004/08/wsdl/in-only"
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"
/>
        <messageReceiver
mep="http://www.w3.org/2004/08/wsdl/in-out"
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
    </messageReceivers>
    <parameter name="ServiceClass"
locked="false">com.test.Test2</parameter>
</service>
<service name="Test1" scope="transportsession">
    <Description>
      Test API
    </Description>
    <messageReceivers>
        <messageReceiver
mep="http://www.w3.org/2004/08/wsdl/in-only"
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"
/>
        <messageReceiver
mep="http://www.w3.org/2004/08/wsdl/in-out"
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
    </messageReceivers>
    <parameter name="ServiceClass"
locked="false">com.test.Test1</parameter>
</service>

In the Test2 service implementation, I have a getConfig() object
which is called by each of the methods to set the internal
application configuration object

    private Config getConfig() throws AxisFault {
        MessageContext mc =
MessageContext.getCurrentMessageContext();
        if(mc.getServiceGroupContext()!=null) {
             Config config =
(Config)mc.getServiceGroupContext().getProperty("config");
             if (config!=null) {
                 return config;
             }
        }
        throw new AxisFault("not logged in");
    }


When the web service client calls the above,
getProperty("config") always returns null. Thus,
there is no sharing taking place.

In the web service client, I do the following:

test1Stub = new Test1Stub(url+"/MailArchiva");
test1Stub._getServiceClient().getOptions().setManageSession(true)
;

Am I missing something important here? Anyone know why the
session is not applied across all servicegroups?

Thanks

Jamie

Re: Multiple classes

Posted by Vincent FINET <vf...@sqli.com>.
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 <vf...@sqli.com> 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 <ja...@fastmail.fm> 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
>>
>>
>
>

Re: Multiple classes

Posted by Vincent FINET <vf...@sqli.com>.
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 <ja...@fastmail.fm> 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
>
>