• Apache Axis2 Practice


    Apache Axis2 Advanced User's Guide

    Web services are application components which communicate using open protocols. Using Web Services we can publish our application's functions to everyone. This tutorial provides step by step instructions to develop Web Services using Axis2 Web Services / SOAP / WSDL engine and Eclipse IDE. Let's start.

    1. Setup the Development Environment


    1.1. First you need to set up the development environment. Following things are needed if you want to create Web Services using Axis2 and Eclipse IDE.

    Some Eclipse versions have compatibility issues with Axis2. This tutorial is tested with Apache Axis2 1.5.2, Eclipse Helios and Apache Tomcat 6.

    1) Apache Axis2 Binary Distribution - Download
    2) Apache Axis2 WAR Distribution - Download
    3) Apache Tomcat - Download
    4) Eclipse IDE – Download
    5) Java installed in your Computer – Download
    6) Tomcat plugin for Eclipse - Download

    7)Apache Axis2 plugin for Eclipse - Download

    1.2. Then you have to set the environment variables for Java and Tomcat. There following variables should be added.

    JAVA_HOME :- Set the value to jdk directory (e.g. C:\Program Files\Java\jdk1.6.0_21)
    TOMCAT_HOME :- Set the value to top level directory of your Tomcat install (e.g. D:\programs\apache-tomcat-6.0.29)
    PATH :- Set the value to bin directory of your jdk (e.g. C:\Program Files\Java\jdk1.6.0_21\bin)

    1.3. Installing Axis2 engine on Tomcat

    Download and install Tomcat 6 or above. Now to install the Axis2 engine copy axis2.war into Tomcat's webapps directory. Now start the Tomcat server.

    Testing the Axis2 Installation

    You can test the Axis2 engine by opening the browser and typinghttp://localhost:8080/axis2 . Your browser will display the Axis2 home page and it should look like:

     

    Axis2 Web Admin Module

    Now click on the "Administration" link and then login as
    User: admin
    Password: axis2 

    After successful login you should be able to access the Administration panel. The administration panel will look like following screen shot:


    1.4. Then click on the Web Service –-> Axis2 Preferences and browse the top level directory of Apache Axis2 Binary Distribution.


    2 Create Web Service


    Deploying the Web Services

    Now copy the HelloWorldService.aar into webapps/axis2/WEB-INF/services directory and restart the Tomcat. The Apache Axis2 engine will deploy the service on the server. Now open the browser and browser the urlhttp://localhost:8080/axis2/services/listServices. Your browser should display the service name as shown below:

    3. Creating a Web service client

    3.1 Select File --> New --> Other… and choose Web Service Client

    3.2 Set the newly created Axis2 Web service (http://localhost:8080/axis2/services/FirstWebService?wsdl) as the Service definition. Then configure the Server runtime as previously and click finish.

    3.3 This will generate two new classes called FirstWebServiceStub.java and FirstWebServiceCallbackHandler.java. Now we can create test class for client and use our web service. Create new class called TestClient.java and paste following code.


  • 相关阅读:
    【转】探秘Java中的String、StringBuilder以及StringBuffer
    【转】深入剖析Java中的装箱和拆箱
    谈谈我对多态的理解
    mysql组合索引之最左原则
    白衣浅谈各个集合的特性
    Linux 下的两个特殊的文件 -- /dev/null 和 /dev/zero 简介及对比
    内网穿透工具的原理与开发实战
    nohup命令说明-转载
    springboot 启动jar正确方式
    maven版本仲裁原则
  • 原文地址:https://www.cnblogs.com/yefengmeander/p/2887588.html
Copyright © 2020-2023  润新知