Chapter 2. Creating a Web Service using JBossWS runtime

2.1. Creating a Dynamic Web project
2.2. Configure JBoss Web Service facet settings
2.3. Creating a Web Service from a WSDL document using JBossWS runtime
2.4. Creating a Web service from a Java bean using JBossWS runtime

<diffmk:wrapper>In this chapter we provide you with the necessary steps to create a Web Service using JBossWS runtime. First you need to create a Dynamic Web project:</diffmk:wrapper>

Before creating a web service, you should have a Dynamic Web Project created:


Create a Web project by selecting New > Project... > Dynamic Web project. Enter the following information:

Click on the Finish<diffmk:wrapper> button. Next you will need to add JBoss Web Service facet to the project:</diffmk:wrapper>

<diffmk:wrapper>If you have already created a new Dynamic Web project, the next step is to add JBoss Web Service facet to the project. Right-click on the project, select its </diffmk:wrapper><diffmk:wrapper>Properties</diffmk:wrapper><diffmk:wrapper> and then find </diffmk:wrapper><diffmk:wrapper>Project Facets</diffmk:wrapper><diffmk:wrapper> in the tree-view on the left-side of the project properties dialog. Tick on the check box for JBoss Web Services and open additional configuration for it, having clicked on the </diffmk:wrapper><diffmk:wrapper>Further configuration required...</diffmk:wrapper><diffmk:wrapper> link. In the opened window</diffmk:wrapper>


Server Supplied JBossWS Runtime: If you have already set a JBoss runtime to the project's target runtime, you may choose Server Supplied JBossWS Runtime and then click Ok to finish the configuration of JBoss Web Service facet.

If the project has no Target Runtime settings, you should check the second radio button and specify a JBossWS runtime from the list. You also can create a new JBossWS runtime, click on the New... button will bring you to another dialog to configure new JBossWS runtime.


See how to configure a new JBossWS runtime here<diffmk:wrapper>.</diffmk:wrapper>

In this chapter we provide you with the necessary steps to create a Web Service from a WSDL document using JBossWS runtime.

At first, please make sure that you have already created a dynamic Web project with JBoss Web Service facet installed.

See how to make it here<diffmk:wrapper> and </diffmk:wrapper>here.

To create a Web Service using JBossWS runtime select File > New > Other > Web Services > Web Service to run Web Service creation wizard.

Let's get through the wizard step-by-step:


First, please select Top down Java bean Web Service<diffmk:wrapper> from the Web Service type list, and select a WSDL document from workspace, click on the Server name link on the page will bring you to another dialog. Here you can specify the server to a JBoss Server and Web Service runtime to JBossWS runtime:</diffmk:wrapper>


Click on the Finish button to see the next wizard view opened:


Click on the Next button to proceed:


On this page, the default package name comes from the namespace of the WSDL document, you also can change it to any valid package name you want. JAX-WS specification should be set to 2.0 if your JBossWS runtime in JBoss Server is JBossWS native runtime. You can specify a catalog file and binding files if you have them. If you want the wizard to generate empty implementation classes for the Web Service, check the Generate default Web Service implementation classes check box. If you want to update the default Web.xml file with the Web Service servlets configured, check the Update the default Web.xml check box. Click on the Next or on the Finish button to generate code.

Once the Web Service code is generated, you can view the implementation class and add business logic to each method.


View the Web.xml file:


<diffmk:wrapper>In the next chapter you will find out how to create a Web service from a Java bean.</diffmk:wrapper>

The Web Service wizard assists you in creating a new Web service, configuring it for deployment, and then deploying it to the server.

To create a Web service from a bean using JBoss WS:

Setup JBoss WS and development environment.

Create a Dynamic Web project.

Add JBossWS Facet to Web project.

Create a Web Service from a java bean:

After the Web Service has been created, the following options may become available depending on the options selected:

<diffmk:wrapper>In the next chapter you will be able to create a Web Service Client from a WSDL document using JBoss WS.</diffmk:wrapper>