Introduction
The Apache Axis2 is a Java-based implementation of both the client and server side of the web service. Apache Axis2 provides a complete object model and a modular architecture that makes it eas to add functionality and support for new web service related specifications and recommendations.Prerequisite
1. Axis2 Server ( you can download from here ) .
2. Intelij Idea ( you can download it from here ) .
3. Maven (you can download it from here ).
Creating the project Structure
create new maven project name OrderProcessWS.
groupId : org.wso2.carbon
artifactId : OrderProcess
version : 1.0.0
Include following configuration to the pom.xml
Package Creation
Create org.wso2.data and org.wso2.service packages
org.wso2.data -this package contains DAO classes need for web Service.
org.wso2.service - this package contains the operations related to the service
Writing Classes
Create Item and OrderDetail classes in org.wso2.data package
Item.java
OrderDetail.java
ProcessOrders.java
Writing Services.xml
services.xml contains the details of the service that we exposed . This configuration file have to create inside the src/main/resources/META-INF folder
services.xml
scope : (Optional Attribute) The time period during which runtime information of the deployed services will be available. Scope is of several types- "application", "soapsession", "transportsession", "request". The default value (if you don't enter any value) will be "request"
class : (Optional attribute) The full qualified name of the service lifecycle implementation class. ServiceLifeCycle class is useful when you want to do some tasks when the system starts and when it shuts down.
Description : (Optional) If you want to display any description about the service via Axis2 web-admin module, then the description can be specified here.
For more information go here.
Finally build the maven project and copy OrderProcessService.aar file inside the project target into <Axis2_HOME>/repository/services and start the axis2 server.
you can find the wsdl represenation of the soap service by browse
http://localhost:8080 and select the OrderProcessService from
deployed services list.
No comments:
Post a Comment