Spring Webservices : What should be good starting point?
I am totally new to Spring Web Services
and so what concept should I start concentrating on and where should I be looking for them and in general what steps would you recom开发者_StackOverflowmend to get to speed with Spring Webservices
Module.
Note: I have an requirement to build Web Service for and consume Web Service from different application and I have never worked with Web Service in the past, I am looking at Spring WS option because both application are developed using Spring Framework, is this a good assumption to look for Spring WS or not ?
Any guidance and suggestion for discussion kind of approach would be highly appreciated.
Thanks.
(...) I am looking at Spring WS option because both application are developed using Spring Framework, is this a good assumption to look for Spring WS or not?
It's not a wrong assumption (bad integration between Spring WS and Spring would be a total irony) but you should not exclude other stacks on the fact your applications are using Spring. JAX-WS stacks (like Apache CFX or JAX-WS RI) provide Spring integration as well.
Personally, I like JAX-WS (that I use for contract-first web services) and, while it's hard to be more specific without more details about your requirements, I simply don't think that Spring WS offers any advantages over JAX-WS and I would probably go for Apache CXF in your case.
Maybe have a look at what others are saying in this previous SO question (please read all answers, the accepted one is not really good in my opinion).
What are your protocol requirements? Do you have to use SOAP, or are you free to use your own XML marshalling over HTTP (e.g. a RESTful approach)?
If you must use SOAP, then see this guide I wrote to Spring WS web services. If you're free to use your own lightweight RESTful web services, then see this example I wrote on RESTful web services.
I wouldn't use Spring WS ONLY because of the reasoning you provide. You need to identify more functional requirments like:
- Can you use markup (JSON, XML, etc.)
- Should you provide content negotiation
- Do you need to provide complex objects (i.e. SOAP as james suggests)
- Are you providing a RESTful service
etc.
I've worked with web services a lot in the past few years and there seems to be a few major projects for creating them:
- Apache Axis (primarily SOAP)
- Apache CXF (primarily SOAP)
- Jersey (REST)
- Restlet (REST)
There are other offshoots like Spring WS, or even Spring MVC, but you need to evalute which will work best.
Personally I use Jersey a lot, which also provides Spring integration. Jersey also has an awesome HTTP client for consuming services, but don't confuse creating a web service as being akin to consuming a web service. They are separate workflows and you could use separate third-party projects for both (e.g. Apache HTTP Client for consuming, and Jersey for producing).
Spring WS might work best for you, but my advice would be don't use it just because the other applications use it...use whatever works best and fulfills your requirements.
精彩评论