J2SE Web Services - Part2
By mkuchtiak on Oct 09, 2006
In the previous article( J2SE
Web Services - Part1 ) I demonstrated how simply a web
service can be created in Java Application using Netbeans5.5 and JAX-WS
The very important step (Step 2) in WS Creation was adding JAX-WS2.0 Netbeans library to a project. The library is, in fact, the aggregation of jar files representing JAX-WS 2.0 (APIs and runtime classes).
Good news is that all
necessary packages from JAX-WS 2.0 incuding
are already the part of Java
SE 6 platform. So, there is no need to add additional
library to a project's class path, when Netbeans is running on Java SE
6. Therefore, the Step 2 is not required.
The advantage of this is big: we can develop an entire web service in pure java application. After that, when it's finished, we can deploy it within an EJB project or Web application.
Using Netbeans 5.5 this technique is easily achievable:
Steps to create a "wrapper" Web Application.
- Follow the steps 1-4 to create a Circle web service inside the GeometricalWS Java Application : Steps to create RPC/literal Web Service in Java Application
- Create a new Web Application ("WebApplication2"), set target server to "Sun Java System Application Server"
- Add a jar file, containing previously built Java
Application (GeometricalWS), by using Project properties ->
Libraries -> Add Project. See the picture:
- Deploy the Web Application project. If you open the SJSAS
admin console, the Circle web service, as a part of WebApplication2,
should be in the list of web services :
- Now you can easily investigate the wsdl file, or test the
web service from the admin console. See the picture: