Hello all... I wanted to post this here and get any comments that people had so I could decide where to go with it...

For the past two days I've been working on a mechanism that would allow you to expose existing Struts-based business logic as Web Services without changing any existing code. What I offer here is a first approximation of that idea.

If you might be interested in this, you can download the first iteration of the project at http://www.omnytex.com/wst.zip

This archive is a sample webapp in exploded format. Just unzip it to your webapps directory of your chosen app server and you should be good to go. I've only tried it on Tomcat however, so anything else is unknown.

In a nutshell, what I've done is written a custom subclass of RequestProcessor. This version will recognize a SOAP-based Web Service request, "unroll" the request, and hand it off to a specified Action. As far as the Action is concerned, it looks just like a regular HTTP form submission, so it processes same as before. Note that the request is forwarded back through ActionServlet, so anything you do should still work. The RequestProcessor then overrides the destination ActionForward that the Action returns, and instead sends it to a special JSP, which renders the response XML. The response type is set properly, and the generated XML is returned. The XML it generates simply dumps all members of the ActionForm, so it's not very smart right now, but as I said, this is a first approximation of the idea.

So, in the end, you should be able to expose any existing Actions as Web Services without changing them. Everything you need is included, except for a JDK, but I assume you have that already (!), including a dirt-simple test client. It's not a true SOAP client, but it gets the job done.

Once you unzip the archive, I suggest reading the readme.txt file in the /source directory. This goes into a bit more detail on everything, as well as explaining how to use this in your own application. I should also note that this RequestProcessor is transparent to non-Web Service requests, i.e., you can use it in your existing apps without changing anything whether you expose anything as a service or not.

I thank anyone in advance that checks this out. Please send me any comments or suggestions you may have either to [EMAIL PROTECTED] or just post them here.

My hope is that given some time to refine this it will be tight enough and useful enough that maybe I can present it to the developer list for possible inclusion in the base Struts distro. That's of course a ways off, if it ever reaches that point, but it's a start I think.

Good day to all!

Frank

_________________________________________________________________
Looking to buy a house? Get informed with the Home Buying Guide from MSN House & Home. http://coldwellbanker.msn.com/



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to