NitZRobotKoder
NitZRobotKoder

Reputation: 1096

Exposing Web Application as Web Service too

I have an web application developed in spring. Now I need to expose certain functionality as Restful Web services. I am not supposed to use Spring Rest features. Below are my questions,

1) Can I use the same codebase as a web app as well as Web service?

2) If the answer to the first one is yes then with very less or minimal changes what would be the best approach for converting web app classes(or some functions) to restful web services? AXIS2 or Jersey? For Jersey, I could see that sample tutorials available in the internet its mostly annotation driven and as my spring web application is already filled with annotations such as @AutoWired,@Component etc I am not sure using Jersey annotations on top of spring annotation would lead to conflicts.

Upvotes: 0

Views: 654

Answers (1)

manurajhada
manurajhada

Reputation: 5390

Yes you can use the same code base, but not as same.. you need to replace some annotations with jersey's annotation as a Web Service is all about its URL and Methods, So need to place URL Path to the methods and have to define request-responce method (post/get) methods over the Java classes and methods.

Also, you need to make xml controllers or wrappers with jersey annotations that will receive the posted xml inputs and produce required xml output, Or JSON as you decide.

Acc to me, Working with jersey will be much similar to spring annotations and easy too.

Upvotes: 1

Related Questions