加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Axis2发布WebService服务

发布时间:2020-12-16 22:25:15 所属栏目:安全 来源:网络整理
导读:使用Axis2发布WebService服务 1. 环境 axis2-1.6.4 eclipse4.4 tomcat7.0 2. eclipse配置axis2 2.1. 下载axis2-1.6.4-bin.zip,并解压 2.2. 在eclipse中配置axis2引用 window – preferences – Web Services – Axis2 Preferences – Axis2 runtime locatio

使用Axis2发布WebService服务

1. 环境

  • axis2-1.6.4
  • eclipse4.4
  • tomcat7.0

2. eclipse配置axis2

2.1. 下载axis2-1.6.4-bin.zip,并解压
2.2. 在eclipse中配置axis2引用
window –> preferences –> Web Services –> Axis2 Preferences –> Axis2 runtime location.

3. 创建Dynamic Web Project

3.1 module version 选择2.5,不支持3.0


3.2 Configuration点击Modify…勾选axis2选项,如下图所示


3.3 创建完成后,目录结构如下图所示

4. 创建wsdl文件

4.1 设置命名空间及绑定类型


4.2 设计wsdl文件


1. 双击修改方法名,如echo
2. 在方法名上右键可添加新方法,入参及返回值


3. 向右箭头–>可以自定义参数类型


4. 双击Binding,绑定参数


5. 右键,生成绑定内容



6. 保存wsdl文件

5. 通过wsdl文件生成java代码

6. 编写业务逻辑

public class HelloWorldSkeleton {

    /**
     * Auto generated method signature
     * 
     * @param save
     * @return
     */

    public void save(org.loushang.helloworld.Save save) {
        System.out.println(save.getIn());
    }

    /**
     * Auto generated method signature
     * 
     * @param echo
     * @return sayHelloResponse
     */

    public org.loushang.helloworld.SayHelloResponse     echo(org.loushang.helloworld.Echo echo) {
        SayHelloResponse response = new SayHelloResponse();
        response.setOut(echo.getIn());
        return response;
    }

}

7. 查看webservice服务

http://localhost:8080/HelloWorldWebService/services/listServices,结果如下图所示

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读