Johan's blog

Creating WebServices based on Session Beans (with NetBeans)

In a previous entry , I wrote about how simple it is to write a Java client using a WebService, using the NetBeans IDE . If you have to create a WebService, you can use NetBeans as well. It is a little more complicated than just consuming a WebService, but still it is very straightforward.

There are a number of ways you can start from. You can use an existing WSDL, or you can start from a Session Bean. The latter is my favorite approach. Typically, you want to expose some existing functionality via WebServices. This functionality is often available in a Session Bean, so using the Session Bean as the source for the WebServices saves you time.

This process is very well explained on the NetBeans site . The Session bean goes into a Java EE Module, and the WebServices goes into a WAR. Combine both in a project, and there is your WebService.

The complexity is not in the creation of a WebService with NetBeans, but rather in the overhead that is been created. I use NetBeans on some workstations, but not on all. I need to work with standalone, command-line tools as well. And the process of creating a WebService with NetBeans is still rather tightly integrated with the NetBeans way of organizing Enterprise Applications - which, I have to be honest, matches the Blueprints very well. But it is a little complex if you want to change things manually.

The nice thing about NetBeans is that all ant-scripts are generated for you, and you don't have to worry about wsgen or other stuff anymore. The problem is that, if you care about wsgen and other tools, you have to dive into a number of property and configuration files, even if you have a very simple WebService. You can do with almost all defaults, but the difficulty is to find the defaults you have to change, in the forest of thousands defaults. 


posted on Monday 07 Apr 2008 at 09:49
Leave a comment
No comments