Hi guys ,
I have a servlet that acts as controller for a jsp pages , and I want this servlet to able to listen to jax ws messages through the Provider interface , this would be an ideal solution. I also tried to have a different class that implements the Provider and with that class to pass messages to my servlet , but also it wasn't successful.
The last resort solution that i'm thinking of is to use some embeddable server (Jetty) and to embed it in my servlet , but it feels a bit stupid because i'm already having a server (tomcat) why should I use another component that basically the same.
Any input?
views:
23answers:
1
+2
A:
I wouldn't do this. They aren't basically the same at all. A servlet listens for HTTP requests synchronously; your JAX-WS listener is asynchronous.
Object-oriented design principles that say objects should do one thing well would advise you to not make these into one component. What's it buying you, anyway? You describe your idea as "ideal" and the alternative as "stupid", but I see no rigorous thought about pros and cons of each. Maybe that will help you decide.
duffymo
2010-06-27 14:18:22
Thanks , for a quick answer.So how would you design an architecture where there should be component that should receive SOAP messages , and this messages need to be parsed and passed to servlet -> so they would be displayed in JPS's.And I prefer no to poll the server , but to have some kind of listening mechanism.
Igor
2010-06-27 14:26:39
I'd emulate a design more like what Spring does.
duffymo
2010-06-27 14:40:23
@Igor, the servlet and the JAXWS listener are both just top-layer components, they should handle translating the incoming message into whatever format you want to represent it and then call into the business logic layer of your app. Both servlet and WS listener can call into same "service" class so you don't duplicate logic.
matt b
2010-06-27 15:38:09
@matt b - a great comment. If you make it an answer I'd surely vote it up.
duffymo
2010-06-27 16:05:53
Duffy could please elaborate a bit , what do you mean by Spring design?Matt -> I just need a component that can receive SOAP , and I don't want to use polling technique.So i'm working building a component that receives messages and transferring them to the servlet.And I would prefer to isolate the servlet from the communication logic.
Igor
2010-06-27 16:08:13