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.



ATG Customize and Enhance your CRS Module easily

Firstly we need to create a folder and give the name of your choice,For example i have given Wirelessstore, inside that folder you create a META-INF folder,and create a MANIFEST.MF file,once this is done then modify the Manifest file property to ATG-Install-Unit:MyWirelessStore(MyWirelessStore is the name i have given instead of the name Store in CRS module) and create a folder with the same name MyWirelessStore under Wirelessstore,after this copy all  CRS-Store folders under this folder.

You can Refer the CommerceReferenceStore Manifest file for this.

Now configure your eclipse and import the necessary folders to your workspace.Resolve the classpath by importing required Jars and Classes to your Buildpath and do a clean build of your Project.

Now create a runAssembler command so that it will pick modules from your newly created folder structure.

runAssembler -m ATGProduction.ear -m DafEar.Admin DPS DSS  DSS DCS.PublishingAgent MyWirelessStore.EStore MyWirelessStore.Recommendations MyWirelessStore.Storefront.NoPublishing    MyWirelessStore.Fulfillment

so now you have the ATGProduction.ear ready to deploy in your Application Server.Deploy it and run the Server with correct datasources you can see the CRS running exactly same way similiar to the one installed through CIM or other ways.

Now modify your JSPs,Java,Components and do a clean build and deploy your changes will appear in the CRS Application.

Similiarly create a runAssembler for the Publishing modules and do the necessary configurations in BCC and do a full deployment.


Issues Faced during creation of CRS Module

If you are customising the CRS Module you need to take care of the reference to absolute path of certain components,one such issue i faced is the application is not able to find the exact keystore location.This happens even adding an item to Cart and further flows.

the keystore location is mentioned in the component /atg/store/security/crypto/SecretKeyStoreManager  with the property 'file'.You need to modify the entry so that it will point to your modified structure.


The actual entry in CRS will be like
file = {appModuleResource?moduleID=Store.EStore&resourceURI=keystore/store-crypto.jks} ,you have to modify this so that it point to MyWirelessStore.

For example in my application the absolute path will be C:\ATG\ATG10.2\Wirelessstore\MyWirelessStore\EStore\keystore\store-crypto.jks
Related Posts Plugin for WordPress, Blogger...