Monday, 26 November 2012

Simple Web Service Creation Example Using CXF Framework and SOAP in Eclips

Simple Web Service Development Example Using CXF Framework:---

Required Configuration :
1)JDK 1.5 and above
2)Eclipse
3)CXF 2+

Plug CXF  with the eclipse:

1)Open the eclipse IDE
2)Go to Window menu then click on the Preference
3)Then go to Web service link and select CXF
4)A window will  open where you will add the CXF home path

5)Then click ok

Create a simple web service using cxf:
For this example iam follow a bottum up approach

1)Creat a simple dynamic web project

2)Create a Class SimpleWebServiceImpl

package com.nik.test;

public class SimpleWebServiceImpl {
   
    public  String addMethod(int a,int b){
        return "Your sum is ="+(a+b);
    }

}

3)Right click on the class and go to New->Other -> Web Service link and select Web service from the populated links
4)
Select the web service type ->
Browse the service Implementation Class ->
Edit the configuration by --Selecting the server runtime, Web Service runtime
Select Client Type as Java Proxy ->
Check in the options if You want to publish and moniter the web services..
Clic Next


5)Select the method to publish as a web service and click next


6)Click next
 7)Click next
 8)Start server
9)Click next
 10)Click Finish
 11)The Web Serviice Explorer window open
 12)Click on the method link and add the parameter value and click ok
13)This shows that your web service method is successfully published