开发者

Beginner Design pattern question (Web Services involved)

I am a noob to web services world. I need to develop a login validator module and e开发者_如何学运维xpose it as a service. I want it to be service independent, i.e I should have the option of exposing it as a SOAP service or REST service in the future.

What pattern should I follow ? Sorry if I am unclear in my requirements, I can clarify as per need.

Thanks !!

Edit : I am using Eclipse as an IDE and Jersey libraries. I am not into any framework, simply using the MVC pattern. I find a lot of difference between SOAP ann REST methods, so I want my methods to be implementation independent - i.e I should be easily able to use my method through a SOAP or REST service call as per need. What should I do for maximum flexibility ?


Picking a good MVC framework and understanding how to use it properly can help ensure that your feature is "service independent". Most of the documentation I've read for good frameworks suggest that you keep your business logic separate from your controller.

If you read the documentation for the tools that you use, and ensure that there is a layer between your business logic and your controllers, then that will make the job of switching from SOAP to REST or some other protocol much, much easier.

Since you mentioned you're using Eclipse in your comment below, I'm assuming you are using or are willing to use Java:

Restlets http://www.restlet.org/

Spring 3.0 REST http://blog.springsource.com/2009/03/08/rest-in-spring-3-mvc/


  1. Develop your service as a POJO. Make sure to respect staless pattern.
  2. Create an EndPoint class for each publication type you require (Soap, Rest, EJB, JMS, what ever)
  3. Use appropriate standard to expose your EndPoint. For Soap and Rest the JAX-WS api and implementations can do it for you using java annotations on your EndPoint.

That's it !

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜