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 sol myr <so...@yahoo.com> on 2006/05/20 20:49:50 UTC

[Axis2] obtaining the service class through factory ?

Hi,
   
  Is there a way to instantiate Service classes through a factory, rather than the 'no arg' constructor ?
   
  I mean, usually the "services.xml" is something like:
  - < service >
-   < parameter name="ServiceClass" locked="false" > package.MyService
  So the axis2 servlet instantiates the service by calling "new MyService()".
  
Unfortunately, my service has a private constructor (for a good reason), and can only be instantiated through
  -   MyFactory.createInstance()
  So I'm looking for is something in the lines of :
  -    < parameter name="ServiceFactory" > package.MyFactory
   
  Is there an easy way to achieve this ?
   
                                Thanks :)
   

		
---------------------------------
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.

Re: [Axis2] obtaining the service class through factory ?

Posted by Ajith Ranabahu <aj...@gmail.com>.
Hi,
Anyway if you take the workaround it means that you'll be handling the
scope by yourself

Ajith

On 6/21/06, Deepal Jayasinghe <de...@opensource.lk> wrote:
> Axis2 current implementation only support default constructor case , and
> you have a workaround;
> - You have to write your own message receiver and use that as your
> message receiver for your service
> - And once the message receiver get the request or when it create
> service impl class , you can create that the way you want.
>
> N:B :- writing message receivers is not a big deal , so you can easily
> achieve your goal by writing a custom message receiver
>
> sol myr wrote:
>
> > Hi,
> >
> > Is there a way to instantiate Service classes through a factory,
> > rather than the 'no arg' constructor ?
> >
> > I mean, usually the "services.xml" is something like:
> > - < service >
> > -   < parameter name="ServiceClass" locked="false" > package.MyService
> > So the axis2 servlet instantiates the service by calling "new
> > MyService()".
> >
> > Unfortunately, my service has a private constructor (for a good
> > reason), and can only be instantiated through
> > -   MyFactory.createInstance()
> > So I'm looking for is something in the lines of :
> > -    < parameter name="ServiceFactory" > package.MyFactory
> >
> > Is there an easy way to achieve this ?
> >
> >                               Thanks :)
> >
> >
> > ------------------------------------------------------------------------
> > Yahoo! Messenger with Voice. Make PC-to-Phone Calls
> > <http://us.rd.yahoo.com/mail_us/taglines/postman1/*http://us.rd.yahoo.com/evt=39663/*http://voice.yahoo.com>
> > to the US (and 30+ countries) for 2¢/min or less.
>
>
> --
> Thanks,
> Deepal
> ................................................................
> ~Future is Open~
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Ajith Ranabahu

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: [Axis2] obtaining the service class through factory ?

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Axis2 current implementation only support default constructor case , and
you have a workaround;
- You have to write your own message receiver and use that as your
message receiver for your service
- And once the message receiver get the request or when it create
service impl class , you can create that the way you want.

N:B :- writing message receivers is not a big deal , so you can easily
achieve your goal by writing a custom message receiver

sol myr wrote:

> Hi,
>  
> Is there a way to instantiate Service classes through a factory,
> rather than the 'no arg' constructor ?
>  
> I mean, usually the "services.xml" is something like:
> - < service >
> -   < parameter name="ServiceClass" locked="false" > package.MyService
> So the axis2 servlet instantiates the service by calling "new
> MyService()".
>
> Unfortunately, my service has a private constructor (for a good
> reason), and can only be instantiated through
> -   MyFactory.createInstance()
> So I'm looking for is something in the lines of :
> -    < parameter name="ServiceFactory" > package.MyFactory
>  
> Is there an easy way to achieve this ?
>  
>                               Thanks :)
>  
>
> ------------------------------------------------------------------------
> Yahoo! Messenger with Voice. Make PC-to-Phone Calls
> <http://us.rd.yahoo.com/mail_us/taglines/postman1/*http://us.rd.yahoo.com/evt=39663/*http://voice.yahoo.com>
> to the US (and 30+ countries) for 2¢/min or less. 


-- 
Thanks,
Deepal
................................................................
~Future is Open~ 




---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org