Methods to Integrate Axis and CXF Webservices in our Code

Download and Unzip the Axis Standard Distribution.Get all the required Axis libraries for generating java files from WSDL.

set the Classpath to these libraries from the command prompt.The libraries list are given below


use the command from Command Prompt for Eg: java org.apache.axis.wsdl.WSDL2Java mywebservice.WSDL to generate the Java Stub Files.

Either write a build script or set the classpath and using javac compile the entire Java Files

This will generate required stub classes for you to invoke the actual Service.

Configure the WebService EndPoints in your Custom Classes and create an instance of the Stub and pass the URl.

Create the Necessary Input which will be passed as the request to the WebService Call.

Invoke a Call and Configure the Response based on your Requirements.


Download and Unzip the CXF Standard Distribution.Get all the required CXF libraries for generating java files from WSDL.

Get any of the sample build.xml and from the sample projects under the CXF home folder.Make the necessary modification for the WSDL name,Jar file name then run the ant prepare task.This will generate the required client and gen folder by default and other additional folders based on your WSDL and XSD's.Configure Endpoints,Ports,Input and Output and you are all set.

Generate Stubs from SoapUI
Here i am using soapUI4.0.0.
Create a Webservice Project from the WSDL file given,After Creating Go to the Services,Right Click the Services,there is an option to Generate Code.Choose appropriate framework from the list.For Example,here we can choose Apache CXF,Select the appropriate check boxes based on your requirement.Below are the five checkboxes.
Client -  Generates Starting point code  for a Client mainline.
Server -  Generates Starting point code  for a Server mainline.
Implementation -  Generates Starting point code  for a Implementation Object.
Build.xml - Generates the Ant build.xml file.
All Code - Generate all starting point code types.Service Proxy,Service Interface,Server Mainline,Client Mainline,Implementation Object and Build.xml file.

Click on the tools button point the CXF 2.X field to the Binary location.Eg:  CXF2.X - C:\apache-cxf-2.2.7\bin (where the cxf folder is the one which you downloaded and unzip from the distribution).Now all set specify the output folder and click the Generate button.The soapUI will resolve all the dependancies and generate your Stubs.Use build.xml to compile your classes.

Configure Endpoints,Ports,Input and Output and you are all set.


S. Thomas said...

Good info... :)

Post a Comment

Related Posts Plugin for WordPress, Blogger...