Httpservletrequest

F

farooq

We have a struts based web-application that we are trying to expose
with web services. The web services part is easily doable (WSDL etc).
The disconnect is as follows. The Action code calls a service code
which does the processing. The Action code passes the request object
(Httpservletrequest) to the service code which retrieves SSN, Name etc,
and does what it does.
I realise that the Httpservletrequest (request object) is an
interface. I have been trying for a while to "fake" it by implementing
it. That idea did not work. Any ideas would be appreciated.

Thanks
 
W

Wendy Smoak

farooq said:
The Action code calls a service code
which does the processing. The Action code passes the request object
(Httpservletrequest) to the service code which retrieves SSN, Name etc,
and does what it does.
I realise that the Httpservletrequest (request object) is an
interface. I have been trying for a while to "fake" it by implementing
it. That idea did not work. Any ideas would be appreciated.

Without knowing anything else, I'd say consider whether your service code
needs the entire request. Coupling the service layer to the Servlet spec
doesn't seem like a good idea to me. Can you instead pass it a User object?

Have you seen this:
http://sourceforge.net/projects/strutsws/
I haven't used it, but remembering the discussion on struts-user it was
meant to expose existing Struts Actions with a minimum of work. Look at the
struts-user archives back in January/February for more info.

Also consider wrapping the request if you need to do something that the
request you're given won't allow you to do (such as add/change parameters.)
 
I

iksrazal

"The Action code passes the request object
(Httpservletrequest) to the service code which retrieves SSN, Name etc,
and does what it does. "

Beyond the oddness of exposing Struts, a JSP technology, as a web
service, kind of anti-pattern defined ie Golden Hammer - I use the
Command Pattern which is basically what an Action is, or a Stateful
bean to do SSO - I would change the Service from Httpservletrequest and
pass in a Map. That's what the Service layer is for - loose coupling.
In general I don't think its possible - though it is an intriguing
challege - and I therefore recommend looking at a framework like Spring
to connect your Web Service to your service layer, after you decouple
HTTPRequest from it.

HTH,
iksrazal
http://www.braziloutsource.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top