Creating JAX-WS and JAX-RS Service Projects
You can create JAX-WS (SOAP) and JAX-RS (REST) service projects for use with the Application Server. You can create a new, empty project and develop the service as a Java class inside the project, or create the project and service in one step using an existing WSDL file.Â
To create an empty project:
- On the Developer Studio Dashboard, click JAX-WS or JAX-RS, leave the first option selected, and click Next.
The Create New JAX-WS Service dialog box appears. - Do the following:
- Type a unique name for the project.
- Specify the package and class name.
- Optionally specify the location where you want to save the project (or leave the default location specified).
- Optionally specify the working set, if any, that you want to include in this project.
- A Maven POM file will be generated automatically for this project. If you want to include parent POM information in the file from another project in this workspace, click Next, click the Specify Parent from Workspace check box, and then select the parent project.
- Click Finish.
The project is created. You now create the web service as a Java class inside this project.
To create the Java service class:
- Right-click the project you just created, and then choose New -> JAX-WS Service Class or New -> JAX-RS Service Class.
The New JAX-WS Class dialog box appears. - Specify the information for the bean class and optionally the interface class, and then click Finish.
The classes are created inside the project.
To create a project and service from a WSDL:
- On the Developer Studio Dashboard, click JAX-WS or JAX-RS, click the option to create the project from a WSDL, and click Next.
- Enter a name for the project, browse to the WSDL file, and specify the CXF home and a custom package name.
You can download the CXF Binary Distribution and extract it. The location where you extract it is your CXF Home.Â
The service class has been generated and contains the public endpoint interface described by the WSDL without the implementation. You now develop the service implementation class inside the project.
You can export the project as a web application (WAR) file or you can add it as dependency of a Composite Application project that you deploy on the WSO2 Application Server. To create a deployable archive (WAR), right-click the project, select Export Project as Deployable Archive, and choose the destination location.