我比较懒惰,不想把user guide全部翻译,就记录一些点吧。
Axis2是全新设计的,在2004年的“Axis峰会”上,大家决定采用新的架构来让Axis更加的富有弹性,更有效率,并且更加的可配置。Axis2现在具有的一些feature:
Speed
Low memory foot print
AXIOM - AXis Object Model
Hot Deployment
Asynchronous Web Services
MEP Support - Message Exchange Patterns
Flexibility
Stability
Component-oriented deployment
Transport framework
WSDL support
有些feature现在看不懂,还是先动手做一下,感性认识一下吧
第一步:下载AXIS2。http://ws.apache.org/axis2/download.cgi。很有趣,在apache的Web Service 的Project目录下面还看不到AXIS2。要下那个binary的版本,因为里面有例程。
第二步:Copy axis2.war到$TOMCAT_HOME/webapps目录下面。Tomcat好像只能用JDK1.4,我在JDK1.5 用不出来。
第三步:打开 http://localhost:8080/axis2,就可以看到axis2的Welcome页面了。点一下Validate 和Services,看是不是都没有错误。都没有错误的话,就表示deploy成功了。那个adminstration页面可以通过上传文件来hot deploy Web service,可以用来remote deploy。
第四步:研究例程。先从"samples/userguide/src"目录下的例程看起。看到写一个web service很简单嘛:
public class MyService {
public OMElement echo(OMElement element) throws XMLStreamException {
//Praparing the OMElement so that it can be attached to another OM Tree.
//First the OMElement should be completely build in case it is not fully built and still
//some of the xml is in the stream.
element.build();
//Secondly the OMElement should be detached from the current OMTree so that it can be attached
//some other OM Tree. Once detached the OmTree will remove its connections to this OMElement.
element.detach();
return element;
}
public void ping(OMElement element) throws XMLStreamException {
//Do some processing
}
public void pingF(OMElement element) throws AxisFault{
throw new AxisFault("Fault being thrown");
}
}
看得出来,函数统一使用OMElement作为参数。在META-INF目录下面有个services.xml文件:
<service name="MyService">
<description>
This is a sample Web Service with two operations,echo and ping.
</description>
<parameter name="ServiceClass" locked="false">userguide.example1.MyService</parameter>
<operation name="echo">
<messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
</operation>
<operation name="ping">
<messageReceiver class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
</operation>
</service>
呵呵,也很简单嘛。有返回值的就用RawXMLINOutMessageReceiver,没返回值的就用RawXMLINOnlyMessageReceiver。把它们编译(要把axis2的jar写到classpath里去)打包压到 MyService.aar,包里文件目录如下:
./\META-INF/services.xml
./userguide/example1/MyService.class
把MyService.aar拷贝到$TOMCAT_HOME/webapps/axis2/WEB-INF/services,然后去点一下http://localhost:8080/axis2页面上的Services,也就是http://localhost:8080/axis2/listServices.jsp,就可以看到MyService已经被列出来了。
关于调用web service的东西蛮多,下次写吧。
ps:
自己补充,打包代码(aar文件)
aar文件就是 Axis Archivel 文件,其内容和jar文件一样。
E:\tmp_doc\ax>jar
用法:jar {ctxu}[vfm0Mi] [jar-文件] [manifest-文件] [-C 目录] 文件名 ...
选项:
-c 创建新的存档
-t 列出存档内容的列表
-x 展开存档中的命名的(或所有的〕文件
-u 更新已存在的存档
-v 生成详细输出到标准输出上
-f 指定存档文件名
-m 包含来自标明文件的标明信息
-0 只存储方式;未用ZIP压缩格式
-M 不产生所有项的清单(manifest〕文件
-i 为指定的jar文件产生索引信息
-C 改变到指定的目录,并且包含下列文件:
如果一个文件名是一个目录,它将被递归处理。
清单(manifest〕文件名和存档文件名都需要被指定,按'm' 和 'f'标志指定的相同顺序。
示例1:将两个class文件存档到一个名为 'classes.jar' 的存档文件中:
jar cvf classes.jar Foo.class Bar.class
示例2:用一个存在的清单(manifest)文件 'mymanifest' 将 foo/ 目录下的所有
文件存档到一个名为 'classes.jar' 的存档文件中:
jar cvfm classes.jar mymanifest -C foo/ .
E:\tmp_doc\ax>jar cvf example1.aar .
标明清单(manifest)
忽略项 META-INF/
增加:META-INF/services.xml(读入= 1442) (写出= 669)(压缩了 53%)
增加:userguide/(读入= 0) (写出= 0)(存储了 0%)
增加:userguide/example1/(读入= 0) (写出= 0)(存储了 0%)
增加:userguide/example1/MyService.class(读入= 971) (写出= 509)(压缩了 47%)
FROM:http://doc.linuxpk.com/46237.html
分享到:
相关推荐
部署WebService(eclipse-axis2)部署WebService(eclipse-axis2)部署WebService(eclipse-axis2)部署WebService(eclipse-axis2)部署WebService(eclipse-axis2)
axis2 webservice 服务端jar包: -->axis2-kernel-1.6.1.jar -->axis2-spring-1.6.1.jar -->axis2-transport-http-1.6.1.jar -->XmlSchema-1.4.7.jar -->wsdl4j-1.6.2.jar -->axiom-api-1.2.12.jar -->axiom...
NULL 博文链接:https://savagegarden.iteye.com/blog/368905
webservice-client-call axis
Axis2--Webservice Axis2--Webservice Axis2--Webservice
一个java编写基于Axis1.4的webservice接口,包括服务端接口和调用端接口。
axis2-webservice axis2-webservice axis2-webservice axis2-webservice axis2-webservice
webService—Axis实例webService—Axis实例webService—Axis实例webService—Axis实例webService—Axis实例webService—Axis实例webService—Axis实例
包含webservice客户端开发所需要所有jar包, axiom-api-1.2.13.jar,axis2-adb-1.4..jar,axis2-adb-1.6.2.jar,axiom-dom-1.2.13.jar,axis2-kernel-1.6.2.jar,axis2-transport-http-1.6.2.jar,axis2-transport-...
axis2例子 webservice axis2 示例axis2例子 webservice axis2 示例axis2例子 webservice axis2 示例axis2例子 webservice axis2 示例axis2例子 webservice axis2 示例
axis2-java2wsdl-1.7.4.jar axis2-jaxbri-1.7.4.jar axis2-jaxws-1.7.4.jar axis2-jibx-1.7.4.jar axis2-json-1.7.4.jar axis2-kernel-1.7.4.jar axis2-metadata-1.7.4.jar axis2-mtompolicy-1.7.4.jar axis2-saaj-...
webservice开发,使用axis2框架技术的jar包下载:axis2-1.7.4-bin、axis2-1.7.4-war。版本为1.7.4,欢迎大家下载使用。
webService 生成插件axis2- idea-plugin-1.7.8
本案例实现使用Axis2生成.arr包发布WebService服务,并使用Axis2生成客户端代码方式调用WebService
Spring集成axis2实现webservice所用到的Jar包,将所有的包放到项目的LIB目录下面
资源包含了:axis2-1.7.4-bin.zip、axis2-1.7.4-war.zip、axis2-eclipse-...备注:资源超过了70M 分成了3部分 见axis2方式开发webservice(一)和 axis2方式开发webservice(二)、 axis2方式开发webservice(三)
webService-Axis-tomcat发布教程.docx
axis2实现webservice功能,详细的myeclipse配置及xml配置
web service axis2