zoukankan      html  css  js  c++  java
  • maven axis2简单部署webservice

    1.配置pom.xml

     1     <dependency>
    2 <groupId>org.apache.axis2</groupId>
    3 <artifactId>axis2</artifactId>
    4 <version>${axis2.version}</version>
    5 </dependency>
    6 <dependency>
    7 <groupId>org.apache.axis2</groupId>
    8 <artifactId>axis2-transport-http</artifactId>
    9 <version>${axis2.version}</version>
    10 </dependency>
    11 <dependency>
    12 <groupId>org.apache.axis2</groupId>
    13 <artifactId>axis2-transport-local</artifactId>
    14 <version>${axis2.version}</version>
    15 </dependency>
    16 <dependency>
    17 <groupId>org.apache.xmlbeans</groupId>
    18 <artifactId>xmlbeans</artifactId>
    19 <version>2.4.0</version>
    20 </dependency>

    2.配置service

    在webapp/WEB-INF下新建HelloWs/META-INF/services.xml

      

    services.xml代码如下

     1 <?xml version="1.0" encoding="UTF-8"?>
    2 <serviceGroup>
    3 <service name="HelloWs" targetNamespace="http://ws.axis2Example/" >
    4 <description>JNLPGenerator service</description>
    5 <schema schemaNamespace="http://ws.axis2Example/" />
    6 <parameter name="ServiceClass" locked="false">axis2Example.ws.HelloWs</parameter>
    7 <operation name="sayHello">
    8 <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
    9 </operation>
    10 </service>
    11 </serviceGroup>

    3.在源代码目录新增类axis2Example.ws.HelloWs

     1 package axis2Example.ws;
    2
    3 public class HelloWs {
    4 public String sayHello(String name) {
    5 if (name == null) {
    6 return "Hello";
    7 }
    8 return "Hello, " + name + "!";
    9 }
    10 }


    参考网址:http://maksim.sorokin.dk/it/2011/01/13/axis2-maven-servlets-tomcat/

  • 相关阅读:
    8.1 管道符| 使用技巧
    7.1 elementui的radio无法选中问题
    2.0 es6数组操作
    小练习-双数日期
    匿名函数、三元表达式、列表生成式
    sys.argv
    常用模块 os,sys,
    Python操作数据库
    Python time模块
    加密模块hashlib
  • 原文地址:https://www.cnblogs.com/icestone/p/2290843.html
Copyright © 2011-2022 走看看