This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
I have some basic idea on web services but never implemented in any of real time projects.
Now i want to learn java web service development and i got plenty of options when i googled for available java webservice frameworks.
Now the list i have with me is JAX-WS, JAX-RS(Jersy, RestEasy), Axis2, Apache CXF, Spring-WS .
Can anybody give me an idea on which one is better to start with and which is being used widely these days??
On the SOAP side, I think Metro (which includes the JAX-WS RI) is probably the most widely used one, followed by Axis2.
For REST, I think it's hands-down Jersey.
I'd start with REST and Jersey, just to see how easy it is, and only graduate to SOAP if necessary. SOAP is more complex (more capable, too), and is in many places being phased out in favor of REST. The WebServicesFaq contains many useful links.
I started playing with Jersy for a couple of hours and its really really easy to start with Jersy if you want to work with JAX-RS.
Based on my initial understanding, with JAX-RS we need to send the data through URL or as HttpServletRequest parameters for POST/PUT requests. But in realtime we may need to send a complex objects to consume the Web Services. It may not be practically feasible to send the data as a flat URL or Request parameters. We may want to send it as an Object(A complex object represing the business model object).
With JAX-WS we can prepare SOAP message for any complex request and send across to the Web Service provider.
Could you please clarify me in what scenarios we can go for Jax-RS and for JAX-WS??
For suppose if we are building a system to provide financial services to the world. Out Web Serice will take the Customer Identity information and provide their Account details, or do some transactions etc.
In such a case which one will you prefer?
Joined: Oct 14, 2008
It may not be practically feasible to send the data as a flat URL or Request parameters.
Why not? Not as part of the URL, obviously, but as part of POST/PUT request bodies it should work nicely. Just in case by "Object" you meant a serialized version of a Java object - that's not a good idea, cross-platform compatibility is one of the major advantages of WS.
As an aside: I think you don't mean "real time", you mean "real world". If you actually meant Real-time_computing, then any kind of network access is right out.
But for JAX-RS, to send the customer data through Request Parameters we can send all by strings in flat way.
Joined: Oct 14, 2008
I think you need to look into JAXB, which is supported by both JAX-RS and JAX-WS. It relieves you of all the details of transmitting structured data, and your resulting code only deals with Java objects.
I can almost guarantee that as long as you're thinking about "request parameters" and such, you're not realizing all the benefits of either of these APIs.