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 Michael Oliver <ol...@sourceonenet.com> on 2005/05/20 17:22:39 UTC
Best Practice for providing Web Services for existing classes
Let's say I have an existing web application, and it has a number of
behaviors that I want to expose via web services. These behaviors are
implemented in classes that are designed to handle web events like post
and get.
If these classes have a method I want to expose such as the following:
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception
(yes some would recognize this is a Struts action class and its default
execute method)
The question is....
1. Is it better/easier to take the guts of this class and copy it to
a class without the request and response and mapping which normally have
nothing to do with the processing of the form?
2. Is it better/easier to just do a Java2WSDL from this class?
3. Or. refactor the meat of this class into a separate class and call
this new refactored class from from it and then run Java2WSDL from the
new refactored class?
Michael Oliver
CTO
Alarius Systems LLC
6800 E. Lake Mead Blvd, #1096
Las Vegas, NV 89156
Phone:(702)643-7425
Fax:(702)974-0341
*Note new email changed from oliverm@matrix-media.com
Re: Best Practice for providing Web Services for existing classes
Posted by Anne Thomas Manes <at...@gmail.com>.
3 -- refactor it.
On 5/20/05, Michael Oliver <ol...@sourceonenet.com> wrote:
>
>
>
> Let's say I have an existing web application, and it has a number of
> behaviors that I want to expose via web services. These behaviors are
> implemented in classes that are designed to handle web events like post and
> get.
>
>
>
> If these classes have a method I want to expose such as the following:
>
>
>
> public ActionForward execute(ActionMapping mapping,
>
> ActionForm form,
>
> HttpServletRequest request,
> HttpServletResponse response) throws Exception
>
>
>
> (yes some would recognize this is a Struts action class and its default
> execute method)
>
>
>
> The question is....
>
>
>
> 1. Is it better/easier to take the guts of this class and copy it to a
> class without the request and response and mapping which normally have
> nothing to do with the processing of the form?
>
> 2. Is it better/easier to just do a Java2WSDL from this class?
>
> 3. Or… refactor the meat of this class into a separate class and call
> this new refactored class from from it and then run Java2WSDL from the new
> refactored class?
>
>
>
>
>
> Michael Oliver
>
> CTO
>
> Alarius Systems LLC
>
> 6800 E. Lake Mead Blvd, #1096
>
> Las Vegas, NV 89156
>
> Phone:(702)643-7425
>
> Fax:(702)974-0341
>
> *Note new email changed from oliverm@matrix-media.com
>
>