aspose file tools*
The moose likes Web Services and the fly likes Webservices made easier ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Webservices made easier ?" Watch "Webservices made easier ?" New topic
Author

Webservices made easier ?

Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10288
    
169

Mark,

First of all, welcome to Javaranch. Good to have you here

I have some working knowledge of webservices (have tried out some helloworld examples and have been involved in a project which uses webservices), but you can consider me a newbie. With whatever little that i have tried out with the examples, i did find that getting started with a webservice wasnt easy. However, with some working experience in other areas of J2EE which includes EJB, i believe that it would be the same for all other technologies too.

But with some of the discussions that have been going on and also looking at one of the reviews for your book, i do see that webservices are considered to be not so easy. Java 5 is supposed to make things easier. Which part of webservices is going to be made easier in Java 5. Any specific areas which you could tell us which you feel were considered to be not so easy in webservices, earlier?

Thanks.


[My Blog] [JavaRanch Journal]
Mark D. Hansen
author
Ranch Hand

Joined: May 29, 2007
Posts: 61
Thanks for your welcome

There are a lot of way that Java EE 5 makes Web Services easier than in J2SE 1.4. Here are a few:

JAX-WS instead of JAX-RPC
=========================
This is one area with a lot of improvement. JAX-WS has replaced JAX-RPC as the primary API for creating and invoking Web services. JAX-RPC has a clumsy data binding that was difficult to work with. That made it difficult and awkward to control how XML/WSDL mapped to Java objects. JAX-WS uses JAXB 2.0 to handle data binding. JAX-WS focuses on the mapping between the WSDL interface definition of a Web service and its Java representation in the method signature structure. But the return and parameter types of the method signature are entirely handled by JAXB 2.0.

JAX-WS also directly supports REST endpoints. It makes it much easier for you to work directly with XML - if you choose not to let JAXB 2.0 do the binding for you. This is accomplished through the Provider<T> interface (server side) and the Dispatch<T> interface (client side).

Annotations / Simplified Packaging
==================================
JSR-181 and JAX-WS/JAXB provide annotations that let you define Web services without needing the confusing and cumbersome XML configuration files required by J2SE 1.4 Web services. For example, you no longer need to specify a webservices.xml file to deploy a Web service. You can simply annotate it with the @Webservice annotation.

Dependency Injection
====================
Java EE 5 lets you acquire references to Web Services clients using the @WebServiceRef annotation. You can also get an instance of a WebServiceContext using @Resource and that gives you access to servlet context and HTTP headers, etc. from within your Web service implementation class.

Chapter 2 of my book provides a lot of detail on all the enhancements (and some of the problems) with Web services in Java EE 5 vs. J2SE 1.4


Mark D. Hansen
Founder and President, AgileIT LLC http://agileitinc.com/
Author of "SOA Using Java Web Services" - http://soabook.com/
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10288
    
169

Originally posted by Mark D. Hansen:
Dependency Injection
====================
You can also get an instance of a WebServiceContext using @Resource and that gives you access to servlet context and HTTP headers, etc. from within your Web service implementation class.



That's interesting. My perception of Webservice was that it was supposed to contain business logic (similar to the EJBs) and belongs to a separate tier and not the web-tier. Information like servlet context are not passed to the EJBs and thats what i thought with webservices too. Isnt that the case?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Webservices made easier ?