struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marco Mistroni" <mmistr...@waersystems.com>
Subject RE: Strus Web Service Enablement
Date Thu, 03 Jun 2004 14:56:26 GMT
Hello again,

>Exactly! Actually...not sure about the template, but when u go via
>WS (webservices) all the client is interested is in getting back XML...
>The XML generated by you action class as a response...

>That's the thing I want to avoid though... I don't want the Actions to
be 
>altered at all (and the ActionForms either if I can help it).
Therefore, 
>the idea is to do all the Web Service stuff externally to those
components.

Yeah... :-) I was meaning some XML as a response.


>That's what the current template JSP does... It just uses reflection to
get 
>a list of all members of the ActionForm, without knowing the specific
class 
>of the ActionForm, and then iterates over the members, calilng the 

just curious..how do u pick the ActionForm from request? Each ActionForm
has potentially a different name....   is it a struts trick?

>appropriate getter for each, and constructing a simple XML response.
Since 
>the RequestProcessor already set the response type to XML, the JSP is
only 
>responsible for constructing the proper SOAP-based response, nothing
more.

Two things about that though are problematic...

>(1) It's just dumping all the members of the class, there's currently
no >way 
>to select which members to incluide, or what order, or any notion of 
>structure beyond a flat list

well, as long as they are in an XML I don't see any problems... it
should
be enough that the element is in the XML, not necessarily element1
before
elemen2...  coz when the XML arrives to the client, the client will look
for certain elements, without caring on the order.


(2) While this simple template might be OK for many situations, it
doesn't 
allow for any flexibility in the returned XML.

That's where my idea of an added config file comes in... I picture it
being 
loaded into memory via a plug-in, just like Struts-Config.xml is.  It
would 
probably, off the top of my head, have a structure something like this:

<web-services-config>

  <service-mapping path="xxxx" target="yyyy" members="zzzz" />

</web-services-config>

... where:

xxxx - matches exactly the path attribute of the <action> from 
Struts-Config.xml being exposed
yyyy - is the path to the JSP to generate the XML output.  This would be

optional.  If it's NOT present, be default the "webServiceResponse.jsp" 
template is used, which is what is there now, which just dumps all
members 
of the ActionForm.  You can also specify a special value of "simple",
which 
would use a new "simpleServiceResponse.jsp" template.  This would make
used 
of the members element...
zzzz - is a comma-separated list of members to display using the
"simple" 
template.  Basically the same thing as the default template except that
you 
can specify which elements to return and in what order.

Any other target would be a JSP designed for a specific Action, so you
could 
do whatever you wanted there, as long as you generate a valid SOAP-based
XML 
response.  This is where a new taglib would probably be useful, to help 
ensure proper structure and whatnot.

Further, if no entry is found for a given Action mapping, or there never
was 
this config file, then it would just proceed as it currently does, using
the 
existing "dump everything" template.  That leaves all of this optional, 
which I think is a good thing (tm).


Then this looks the way :-) ..hopefully during the night u will find
more
Responses on this from Struts committers...


>Aspect Oriented Programming ...give it a check... u can add dynamic

>Ok, sure, I've heard of it, just didn't recognize the acronym :)  I'm
not 
>sure how it would fit in here though, my admittedly limited
understanding >is 
>that AOP is more or less a technique for architecting a system (i.e.,
view 
>things as Aspects instead of Objects, along those lines).

As I said, it was just a wild idea... if u can invoke aspects (to log
etc)
At certain point in a class/method, u could  reuse same technique before
Exiting the execute() method of an action... redirecting to the proper
page.. thought my brain stops here... I m talking from examples that I
have seen, I haven\t had the time 2 practice ...

Regards
	marco




_________________________________________________________________
Watch the online reality show Mixed Messages with a friend and enter to
win 
a trip to NY 
http://www.msnmessenger-download.click-url.com/go/onm00200497ave/direct/
01/


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


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


Mime
View raw message