In this example we are using Apache CXF for JAX-WS implementation , see more about Apache CXF
2. Extract CXF zip file
3. Setup CXF run time in eclipse
Go to Eclipse Window->Preference->Web services and select CXF run time
3. Right click on the dynamic web project and create a new web service
4. Click on next button and we can see the below window
1.Select web service implementation class (MyWebService)
2.Slider should be in Start Service point
3.Service Runtime should be Tomcat 6
4.Web service run time should be Apache CXF
5.Service project should be this project
6.Check Publish the Web service option
5. Click on next and start the server and click on finish .That's all Web service implementation is done now we can see the generated wsdl file.
2. Click on WSDL page and enter the WSDL url (Open MyWebService.wsdl file and get the wsdlsoap:address and append ?wsdl) example :http://localhost:8080/JAX-WS-CXF/services/MyWebService?wsdl
3. Click on go button and we can see the web service methods over there in the next screen. Select giveWelcome method and test it.
Software Used
- Eclipse Kepler Release
- Tomcat 6
- Java 1.6
- CXF 2.7.6
Environment Setup
1. Download apache CXF from http://www.apache.org/dyn/closer.cgi?path=/cxf/2.7.6/apache-cxf-2.7.6.zip2. Extract CXF zip file
3. Setup CXF run time in eclipse
Go to Eclipse Window->Preference->Web services and select CXF run time
Create Web Service
1. Create a Dynamic web project in eclipse and choose Tomcat 6 as Target run time2. Create a java class to implement Web service method
4. Click on next button and we can see the below window
1.Select web service implementation class (MyWebService)
2.Slider should be in Start Service point
3.Service Runtime should be Tomcat 6
4.Web service run time should be Apache CXF
5.Service project should be this project
6.Check Publish the Web service option
Test Web Service
1. Go to Eclipse run-> and Launch Web services Explorer2. Click on WSDL page and enter the WSDL url (Open MyWebService.wsdl file and get the wsdlsoap:address and append ?wsdl) example :http://localhost:8080/JAX-WS-CXF/services/MyWebService?wsdl
3. Click on go button and we can see the web service methods over there in the next screen. Select giveWelcome method and test it.
No comments:
Post a Comment