Axis2服务端研究好几个小时,终于解决了

需要下载:

地址1:

可以从镜像站下载: 上海大学开源镜像站

地址2:

链接:从百度网盘下载;

密码:8nwu

其中第二个可以不用下;

解压后

将3,4解压后的jar放到D:\eclipse\plugins,也就是安装目录的PLUGINS文件夹下;

在eclipse里面设置axis2运行时环境:

Windows-preferences-web services-axis2 preferences-axis2 runtime:

选择路径后确定

然后在eclipse里面新建一个dynamic web project;(我这里是XA)写你的用于服务的java类,如图:

此方法就是传4个参数,然后返回一个xml格式字符串;

然后建立webservice:

右键左边项目资源浏览器里面的刚才新建的服务类:SyncData.java,-web service-create webservice;

注意将configuration中第二项改成 axis2;然后一路下去生成webservice;

此时左侧项目自动生成相应文件如下图:

可以看到生成了很多新的文件;

打开WEB-INF的lib,发现里面自动导入了很多jar包,但这里缺少一个(可能是eclipse版本的问题)需要手动导入;

打开F:\java库\axis2-1.7.7\axis2-1.7.7-bin\axis2-1.7.7(文章开头下载后的解压路径),

打开lib,复制里面的xmlschema-core-2.2.1.jar这个jar包到eclipse里面左侧XA项目中的WEB-INF/lib;(重要);

并且删除项目lib中的XmlSchema-1.4.7.jar(相当于用xmlschema-core-2.2.1.jar替换掉XmlSchema-1.4.7.jar)

Jar包导入后,现在修改:

双击项目中的services.xml:

<service name="SyncData" >

<Description>

Please Type your service description here

</Description>

<messageReceivers>

<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />

<messageReceiver  mep="http://www.w3.org/2004/08/wsdl/in-out"  class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>

</messageReceivers>

<parameter name="ServiceClass" locked="false">com.ams.webService.SyncData</parameter>

</service>

上方是原内容,注意红色字,现在修改为:

<service name="SyncData" >

<Description>

Please Type your service description here

</Description>

<messageReceivers>

<messageReceiver mep="http://www.w3.org/ns/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />

<messageReceiver  mep="http://www.w3.org/ns/wsdl/in-out"  class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>

</messageReceivers>

<parameter name="ServiceClass" locked="false">com.ams.webService.SyncData</parameter>

</service>

至此,修改完毕;webservice服务端可正确发布;

通过spring配置数据源时必看:

如果提示报错找不到javax/ws/rs/Produces ;

复制F:\java库\axis2-1.7.7\axis2-1.7.7-bin\axis2-1.7.7中的jsr311-api-1.1.1.jar到项目lib中;

在webservice的类中取得spring的bean:

此方法并没有将AXIAS2集成到spring中,在webservice服务类中无法通过Autowired来装载spring的bean,必须通过spring的xml配置文件来查找自动状态的bean;

public static ApplicationContext ac=new ClassPathXmlApplicationContext(new String[]{"/applicationContext.xml"});

public  ABSDao absDao = (ABSDao) ac.getBean(ABSDao.class);

第一行取得ApplicationContext,第二行通过ApplicationContext来取得需要的bean,注意,这个bean没有直接配置在xml文件中,而是通过自动扫描对应包的方式配置到xml中的,因此,这个bean没有name,id等属性,所以这里只能通过xxx.class的方式来getbean

eclipse中AXIS2发布过程的更多相关文章

  1. Eclipse中Axis2发布WebService

    介绍:Axis是apache下一个开源的webservice开发组件. l  开发工具下载: 1.  eclipse的Java EE版本.下载地址:http://www.eclipse.org/dow ...

  2. eclipse中tomcat发布失败(Could not delete May be locked by another process)原因及解决办法

    在eclipse中tomcat发布项目时,偶尔出现了以下情况: publishing to tomcat v7.0 services at localhost has encountered a pr ...

  3. 在eclipse中部署发布web项目 和 更改eclipseweb项目发布的路径

    我的工作空间:d:workspaceweb项目名称:xxx在eclipse配置完tomcat后,发布到的路径是 d:\workspace\.metadata\.plugins\org.eclipse. ...

  4. Eclipse + Apache Axis2 发布RESTful WebService(二)配置开发环境

    1. 下载axis2相关软件地址:http://axis.apache.org/axis2/java/core/download.html 2. 安装插件:将axis2-eclipse-codegen ...

  5. Eclipse + Apache Axis2 发布RESTful WebService(三)第一个程序Hello Axis2 !(未成功)

    此路不通 Axis2发布SOAP WebService非常简单,建一个Dynamic Web Project,然后为它建一个Axis的Web Service(Tomcat7+JDK),就会生成Clas ...

  6. Eclipse + Apache Axis2 发布SOAP WebService(三)第一个程序Hello Axis2 SOAP!

    因为Axis2同时支持SOAP和RESTful的WebService开发. 我的目标主要是RESTful,这里简单记录一个SOAP的小例子: 原文地址:https://jingyan.baidu.co ...

  7. Eclipse + Apache Axis2 发布RESTful WebService(一)基础知识

    1.什么是WebService 学习 WebService 第一步:体系结构.三元素SOAP/WSDL/UDDI 2.什么是Axis2 Axis2是Apache一套崭新的WebService引擎(框架 ...

  8. 在eclipse中maven web项目部署到tomcat,访问不了

    修改eclipse中tomcat发布路径后,能正常访问

  9. eclipse中build path与Web Deployment Assembly的作用,区别

    转自:https://blog.csdn.net/heart_mine/article/details/79402792 以下内容只为做个笔记记录已下,有问题可以留言,欢迎补充. 今天在eclipse ...

随机推荐

  1. Spring Boot :Druid Monitor

    忙里偷个闲,在这里分享一下SpringBoot集成Druid实现数据库监控功能,有什么错误欢迎大家指出! 参考文件: Spring实现Druid监控:https://www.cnblogs.com/w ...

  2. Android上线check_list

    Android 上线 check_list 类型 序号 检查项 结果(pass/no) 安装 卸载 1 非Root环境下的安装.卸载 2 Root环境下的安装.卸载 3 安装文件检查,无泄漏用户信息的 ...

  3. vue+element ui项目总结点(六)table编辑当前行、删除当前行、新增、合计操作

    具体属性方法参考官方网站:http://element-cn.eleme.io/#/zh-CN/component/installation <template> <div clas ...

  4. 洛谷 P2984 [USACO10FEB]给巧克力Chocolate Giving

    题目描述 Farmer John is distributing chocolates at the barn for Valentine's day, and B (1 <= B <= ...

  5. ssh复制remote

    rsync rsync localdirectory username@10.211.55.4:/home/username/Downloads/localdirectory -r

  6. canvas 在视频中的用法

    <!doctype html> <html> <head> <meta charset="UTF-8"> <title> ...

  7. python常用模块之json和pickle模块

    json模块 json.dumps     将 Python 对象编码成 JSON 字符串 json.loads       用于解码 JSON 数据.该函数返回 Python 字段的数据类型. pi ...

  8. Python基础篇 -- 列表

    3.2 列表的增删改查 ​ 列表使用 [] 来表示,列表中每个元素与元素之间用逗号隔开 ​ 列表也有索引和切片 # 切片切出来的也是列表 lst = ["梅西", "内马 ...

  9. 基于ubuntu 14.04 kvm虚拟化部署

    1. 宿主机环境(dell备份服务器) Ubuntu 14.04 LTS 64位 内存:16G 硬盘:2T 2. 确认CPU是否支持硬件虚拟化 root@shwilling:~# egrep -o ' ...

  10. PyQt5(1)——QToolTip, QPushButton, QMessageBox, QDesktopWidget

    #面向对象方法 import sys from PyQt5.QtWidgets import QApplication, QWidget, QToolTip, QPushButton, QMessag ...