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

Webservice-axis2+hibernate配置

发布时间:2020-12-16 23:03:34 所属栏目:安全 来源:网络整理
导读:网上教程很多,每个人具体情况不同,我是需要在eclipse下用axis2和hibernate, 自己动手,并记录过程。 1,下载准备 eclipse下载 hibernate eclipse工具 axis2: axis2-eclipse-codegen-plugin-1.6.2? axis2-eclipse-service-plugin-1.6.2? 2,axis原理 axis2

网上教程很多,每个人具体情况不同,我是需要在eclipse下用axis2和hibernate, 自己动手,并记录过程。

1,下载准备

eclipse下载

hibernate eclipse工具

axis2:

axis2-eclipse-codegen-plugin-1.6.2?

axis2-eclipse-service-plugin-1.6.2?

2,axis原理

axis2通过客户端和服务端 发送接收soap协议,http+xml,完成消息处理。soap协议是xml的子集,全称是Simple Object Access Protocol。

web serivice消息生命周期

3,配置部署

axis2启动方式是在web.xml文件中添加servlet和servlet-mapping,和struts一样..其实web都是这样

<!--Axis2?config?start-->
<servlet>
	<servlet-name>AxisServlet</servlet-name>
	<servlet-class>org.apache.axis2.transport.http.AxisServlet</servlet-class>
	<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>??
?<servlet-name>AxisServlet</servlet-name>??
?<url-pattern>/services/*</url-pattern>??
</servlet-mapping>?
<!--Axis2??end-->


把hibernate eclipse压缩包,axis2压缩包放到eclipse dropin目录下解压缩,启动eclipse,

视图中有hibernate工具表示hibernate插件安装成功:

file-new-other-对方框中有axis2代表axis2插件安装成功

4,代码开发

新建java工程(如果仅用于生成aar文件,则不需要使用web工程),新建测试类

package?test;

public?class?TestWS?{
	public?String?sayHello(String?str)
	{
		return?"say?"+str;
	}
}

5,生成服务端aar文件

new-other-axis2 serivce Archiver

skip wsdl

生成aar,放在axis2war包service目录下,服务端部署完毕

get访问:http://localhost:8080/Axis2/services/AxisService/showName?name=aaa&password=bbb

访问控制:可使用iptable或者过滤器进行访问控制:http://blog.chinaunix.net/uid-20478213-id-1942011.html

参考:http://feiyeguohai.iteye.com/blog/1575700

(编辑:李大同)

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

    推荐文章
      热点阅读