You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Guido García Bernardo <gg...@itdeusto.com> on 2004/01/19 21:01:09 UTC

Struts and webservices

Hello

Our project is not Struts based. We must expose operations as xml
services (not standard web services) with a structure like the following
one:
    <business id="login">
        <parameter name="username" value="ronaldinho" />
        <parameter name="pass" value="tiger" />
    </business>

We want to migrate it to Struts, so the first step is to map that XML
structure into an ActionForm...  I think we must overwrite
RequestProcessor doing:

public MyRequestProcessor extends RequestProcessor {
    ActionForm processActionForm( req, res ) {
        if (client is a xml service) {
            SAXBuilder builder = new SAXBuilder( req.getInputStream() );
            ...

            // THE MAIN PROBLEM IS HERE !!
            ActionForm form = new LoginActionForm(); <------

            form.setUserName( username );
            form.setPassword( pass );
            return form;
       } else {
            return super.processActionForm( req, res );
       }
    }
}

My questions are:
    1. How can I know the ActionForm class in each case (it is not
always a LoginActionForm...)?
    2. Is there any advantage/drawback with etending RequestProcessor?
(maybe I can't use other RequestProcessors like Tiles or Validator ones)
    3. Should we do anything with ActionServlet, extending it instead of
RequestProcessor, etc.

Any kind of opinion, sugerence or any other consideration are welcome!!

Thank you very very much,
Guido García Bernardo
PD. BTW, is there any practical information or project about integrating
Struts and standard webservices (soap...)?


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


RE: Struts and webservices

Posted by Greg Hess <gh...@wrappedapps.com>.
Hi Guido,

I have recently migrated a proprietary(non-standard) web service
implementation in a Struts based web app using Apache Axis
http://ws.apache.org/axis/.

Struts and Axis are both servlets, Axis handles all XML messages and
Struts handles all form processing. If all you need is another way to
process your web service calls just use Axis or some other web service
framework and leave Struts for form processing, templating/tiles and
validation. The code snippet you have provided is exactly what a web
service framework will do for you.

HTH,

Greg
  
> -----Original Message-----
> From: Guido García Bernardo [mailto:ggarciab@itdeusto.com]
> Sent: Monday, January 19, 2004 3:01 PM
> To: Struts Users Mailing List
> Subject: Struts and webservices
> 
> Hello
> 
> Our project is not Struts based. We must expose operations as xml
> services (not standard web services) with a structure like the
following
> one:
>     <business id="login">
>         <parameter name="username" value="ronaldinho" />
>         <parameter name="pass" value="tiger" />
>     </business>
> 
> We want to migrate it to Struts, so the first step is to map that XML
> structure into an ActionForm...  I think we must overwrite
> RequestProcessor doing:
> 
> public MyRequestProcessor extends RequestProcessor {
>     ActionForm processActionForm( req, res ) {
>         if (client is a xml service) {
>             SAXBuilder builder = new SAXBuilder( req.getInputStream()
);
>             ...
> 
>             // THE MAIN PROBLEM IS HERE !!
>             ActionForm form = new LoginActionForm(); <------
> 
>             form.setUserName( username );
>             form.setPassword( pass );
>             return form;
>        } else {
>             return super.processActionForm( req, res );
>        }
>     }
> }
> 
> My questions are:
>     1. How can I know the ActionForm class in each case (it is not
> always a LoginActionForm...)?
>     2. Is there any advantage/drawback with etending RequestProcessor?
> (maybe I can't use other RequestProcessors like Tiles or Validator
ones)
>     3. Should we do anything with ActionServlet, extending it instead
of
> RequestProcessor, etc.
> 
> Any kind of opinion, sugerence or any other consideration are
welcome!!
> 
> Thank you very very much,
> Guido García Bernardo
> PD. BTW, is there any practical information or project about
integrating
> Struts and standard webservices (soap...)?
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org


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


RE: Struts and webservices

Posted by Sandra Cann <sc...@jcorporate.com>.
> PD. BTW, is there any practical information or project about 
> integrating Struts and standard webservices (soap...)?

Yes, have a look here for a description of a Struts and Expresso based
webservices implementation using Apache Axis :
http://www.jcorporate.com/econtent/Content.do;jsessionid=a57s8imLRm08?state=
resource&resource=801. 

Or to access all related Expresso WebServices documentation see
http://www.jcorporate.com/econtent/Content.do?state=template&template=2&reso
urce=738&db=default

This project's source code is available but is not free $.

Cheers
Sandra Cann


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