Using JAX-WS Annotators with Spring
This tutorial walks you through using the JAX-WS Annotator to produce a JAX-WS web service from a Spring service. In this tutorial, you will learn how to:
- Enable JAX-WS for a Spring service
- Deploy the application and test the service
1. Enable JAX-WS for a Spring Service
The JAX-WS annotator configures the web project for JAX-WS support and configures the Spring Service to be a JAX-WS endpoint.
- Create a scaffolded CustomersApp project.
- In the CustomerApp web project, open the Service implementation class (org.customerapp.service.CustomerServiceImpl.java).
- Switch to the JAX-WS Annotations view. If the view isn’t visible, open it by selecting Window>Show View.
- Click Enable JAX-WS.
- Select the org.customerapp.service package as the location/package where the endpoint should be generated.
- Select CustomersApp-service-context.xml from the list of all Spring context files in the project. Your selection is the individual context file that should be updated with the required JAX-WS configuration.
- Save the changes, and then open the service endpoint interface (org.customerapp.service.CustomerServiceImplEndpoint.java).
Although no additional configuration is required for this tutorial, the JAX-WS annotator lets you further configure the service endpoint with relevant JAX-WS annotations. If you double-click the interface name (CustomerServiceImplEndPoint) in the code or select it in the outline view, the configuration panel displays a list of available class-level annotations. As you configure the class/interface using the annotator, the service endpoint is immediately updated to reflect the configuration.
The JAX-WS annotator also lets you further configure the class/interface methods with relevant JAX-WS annotations. If you double-click the deleteCustomer() method in the code or select it in the outline view, the configuration panel displays a list of available method-level annotations. There are many JAX-WS annotations and configuration options, and they are grouped into categories that can be accessed using tabs.
2. Deploy the Application and Test the JAX-WS Web Service
- Right-click CustomersApp, and select Run As>MyEclipse Server Application.
- With the application deployed, click the Open Web Service Explorer link on the JAX-WS annotator. This opens the WSDL in the Web Service explorer, which can be used for testing the web service.
If you want to test the service in another testing tool, the WSDL URL is: http://localhost:8080/CustomersApp/jaxws/CustomerServiceImplEndPoint?wsdl