Showing posts with label webservice. Show all posts
Showing posts with label webservice. Show all posts

Saturday, March 21, 2015

How To Create Axis2 Client for Axis2 Service using Maven


This Article is continuation of previous article on How to Create Axis2 Web service Using Maven Project .

Creating Project Structure

create new maven project name OrderProcessClient.

groupId : org.wso2.carbon
artifactId : OrderProcessClient
version : 1.0.0

Include following configuration to the pom.xml


pom.xml

Start the axis2 server that start in previous tutorial.
Download wsdl file of the service in to project Resource folder by going to the OrderProcessService link and build the project.
From this Step Service Stub class of the Service is generated in the org.wso2.service package.

Writing Client Code by Use of Service Stub Class

Create OrderProcessClient class in org.wso2.client folder
OrderProcessingClient.java
Finally you can run this class and check the functionality of your service.





Wednesday, March 18, 2015

How to Create Axis2 Web service Using Maven Project

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

create ProcessOrders class in org.wso2.service package
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

name :  The service name will be the name of the archive file if the .aar file contains only one service, or else the name of the service will be the name given by the name attribute.

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.