Methods to Integrate Axis and CXF Webservices in our Code

Axis
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


axis.jar,org.apache.commons.logging_1.0.4.v200904062259.jar,
org.apache.commons.logging_1.0.4.v201005080501.jar,
commons-discovery-0.2.jar,jaxrpc.jar,jaxws-rt.jar,jaxws-tools.jar,
saaj.jar,resources.jar,javax.wsdl_1.5.1.v200806030408.jar,
javax.wsdl_1.5.1.v200806030408.jar

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.


CXF

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 build.properties 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.



Comments

  1. Good info... :)
    http://www.acehints.com/p/site-map.html

    ReplyDelete

Post a Comment

Popular posts from this blog

BCC site status inaccessible Agent Production in error state

Weblogic Issues during EAR Deployment Exception in AppMerge flows progression

DUseSunHttpHandler=true weblogic.net.http.SOAPHttpsURLConnection Weblogic/Java HttpHandler issues