In this tutorial we will show how to deploy a JAX-WS Web service on JBoss AS 7. You will see how you can easily deploy and test a Web service in the new application server release.
In order to use Web services in the new application server release you need the following extension in your configuration file:
<extension module="org.jboss.as.webservices"/>If you are using JBoss AS 7.1.1 this extension is already included in the standalone.xml configuration file, otherwise earlier releases include it in the -preview.xml configuration files so for example if you want to start the standalone server and user webservices you need to use the --server-config option. For example:
JBoss AS 7 ships with Apache CXF web services implementation. Apache CXF is an open source services framework. CXF helps you build and develop services using frontend programming APIs, like JAX-WS and JAX-RS. These services can speak a variety of protocols such as SOAP, XML/HTTP, RESTful HTTP, or CORBA and work over a variety of transports such as HTTP, JMS or JBI.
So let's create a simple Web service contained in a Web application:
And this is the corresponding Web service implementation:
As this Web service is implemented as a Servlet, we need registering the Servlet into the web.xml as usual:
Now deploy the Web application and verify from that the Web service has been published. (We have used a Web application named balance.war).
In AS7 you don't have anymore the jbossws Web application but you can use the new Web management at http://localhost:9900/console
In the Web tab you can find the Web services link where you can see the list of the Web services published.
Now writing an Apache CXF client is just a matter of seconds: