You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Patrice Le Cozler <pl...@gmail.com> on 2006/09/28 17:52:08 UTC

call a struts action from an axis service

Hi,

Here is my (axis newbie) problem: I developed a struts webapp that insert
data to a database using ibatis.
Now I want to add some kind of webservice connector that does the same job.
I think the best way to do that would be to find a way of calling the struts
action from within the axis service class but I don't know how to do that
since my service class don't know about ActionMapping, ActionForm,
HttpServletRequest and HttpServletResponse parameters.
Did anybody faced a similar problem (and found a solution) ?

Thanks for help

Re: call a struts action from an axis service

Posted by Patrice Le Cozler <pl...@dexem.com>.
On 9/29/06, Antonio Petrelli <ap...@apache.org> wrote:
>
> Patrice Le Cozler ha scritto:
> > My business logic is not in actions but is not struts-independant
> > since it
> > uses datasources initialized during struts servlet loading. Is there a
> > way
> > to get theses datasources and more generally get struts config from
> > another
> > servlet inside the same webapp ?
>
> For datasources, you can use JNDI (the simplest way):
>
> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
> Or you can use Spring IoC container (this is what I prefer):
> http://www.springframework.org/
>
> About Struts config, I don't know how you it is useful for a webservice,
> what do you want to do with it?


The struts action will still be used. I just wanted to reuse the same config
for the webservice as I don't know how to configure datasources in an axis
service. I should probably redirect my question to an axis or spring list...

Thanks for your help Antonio.


Ciao
> Antonio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: call a struts action from an axis service

Posted by Antonio Petrelli <ap...@apache.org>.
Patrice Le Cozler ha scritto:
> My business logic is not in actions but is not struts-independant 
> since it
> uses datasources initialized during struts servlet loading. Is there a 
> way
> to get theses datasources and more generally get struts config from 
> another
> servlet inside the same webapp ?

For datasources, you can use JNDI (the simplest way):
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
Or you can use Spring IoC container (this is what I prefer):
http://www.springframework.org/

About Struts config, I don't know how you it is useful for a webservice, 
what do you want to do with it?

Ciao
Antonio

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


Re: call a struts action from an axis service

Posted by Patrice Le Cozler <pl...@gmail.com>.
My business logic is not in actions but is not struts-independant since it
uses datasources initialized during struts servlet loading. Is there a way
to get theses datasources and more generally get struts config from another
servlet inside the same webapp ?

On 9/28/06, Antonio Petrelli <ap...@apache.org> wrote:
>
> Patrice Le Cozler ha scritto:
> > Hi,
> >
> > Here is my (axis newbie) problem: I developed a struts webapp that
> insert
> > data to a database using ibatis.
> > Now I want to add some kind of webservice connector that does the same
> > job.
> > I think the best way to do that would be to find a way of calling the
> > struts
> > action from within the axis service class but I don't know how to do
> that
> > since my service class don't know about ActionMapping, ActionForm,
> > HttpServletRequest and HttpServletResponse parameters.
> > Did anybody faced a similar problem (and found a solution) ?
>
> Sure, simply don't call an action :-) you have to call the same Model
> (in the MVC model) part that the Struts action calls.
> If you put all your business logic inside your action then probably you
> should refactor it to be Struts-agnostic.
>
> Ciao
> Antonio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: call a struts action from an axis service

Posted by Antonio Petrelli <ap...@apache.org>.
Patrice Le Cozler ha scritto:
> Hi,
>
> Here is my (axis newbie) problem: I developed a struts webapp that insert
> data to a database using ibatis.
> Now I want to add some kind of webservice connector that does the same 
> job.
> I think the best way to do that would be to find a way of calling the 
> struts
> action from within the axis service class but I don't know how to do that
> since my service class don't know about ActionMapping, ActionForm,
> HttpServletRequest and HttpServletResponse parameters.
> Did anybody faced a similar problem (and found a solution) ?

Sure, simply don't call an action :-) you have to call the same Model 
(in the MVC model) part that the Struts action calls.
If you put all your business logic inside your action then probably you 
should refactor it to be Struts-agnostic.

Ciao
Antonio

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