简单axis2例子实现.docx

上传人:b****8 文档编号:9005542 上传时间:2023-02-02 格式:DOCX 页数:20 大小:23.12KB
下载 相关 举报
简单axis2例子实现.docx_第1页
第1页 / 共20页
简单axis2例子实现.docx_第2页
第2页 / 共20页
简单axis2例子实现.docx_第3页
第3页 / 共20页
简单axis2例子实现.docx_第4页
第4页 / 共20页
简单axis2例子实现.docx_第5页
第5页 / 共20页
点击查看更多>>
下载资源
资源描述

简单axis2例子实现.docx

《简单axis2例子实现.docx》由会员分享,可在线阅读,更多相关《简单axis2例子实现.docx(20页珍藏版)》请在冰豆网上搜索。

简单axis2例子实现.docx

简单axis2例子实现

WebService学习之axis

看着网上的资料学习了一下,做点笔记以防以后忘记。

一、准备工作:

   到axis官方网站下载相应的jar包,我下的是1.4final版。

   http:

//ws.apache.org/axis/

二、建立项目:

   直接在MyEclipse中建立了一个web项目。

将相应的jar包拷贝到lib文件夹下

三、创建一个WebService服务

   直接创建一个类HelloClient.java

Java代码

1.package com;  

2.  

3.public class HelloServer {  

4.    public String sayHello(String name) {  

5.        return "Hello " + name;  

6.    }  

7.}  

packagecom;

publicclassHelloServer{

publicStringsayHello(Stringname){

return"Hello"+name;

}

}

   axis支持两种方式创建,一种是将编写好的java文件改为*.jws文件。

个人觉得这样不好,所以就用另外一种,采用在server-config.xml文件中配置的方式。

注意:

该文件位置为WEB-INF目录下

Xml代码

1.

xml version="1.0" encoding="UTF-8"?

>  

2.

//xml.apache.org/axis/wsdd/"  

3.    xmlns:

java="http:

//xml.apache.org/axis/wsdd/providers/java">  

4.      

5.          

6.        

7.            value="false" />  

8.          

9.          

10.          

11.          

12.        

13.            value="org.apache.axis.attachments.AttachmentsImpl" />  

14.          

15.  

16.          

17.            

org.apache.axis.handlers.JWSHandler">  

18.                  

19.              

20.            

org.apache.axis.handlers.JWSHandler">  

21.                  

22.                  

23.              

24.          

25.      

26.  

27.    

28.        type="java:

org.apache.axis.transport.local.LocalResponder" />  

29.    

30.        type="java:

org.apache.axis.handlers.http.URLMapper" />  

31.    

32.        type="java:

org.apache.axis.handlers.SimpleAuthenticationHandler" />  

33.  

34.    

MSG">  

35.          

36.          

37.          

38.        http:

//xml.apache.org/axis/wsdd/  

39.      

40.  

41.    

RPC">  

42.          

43.          

44.      

45.    

 #ff0000">

RPC">  

46.          

47.          

48.      

49.  

50.      

51.          

52.              

53.            

54.                type="java:

org.apache.axis.handlers.http.HTTPAuthHandler" />  

55.          

56.        

list"  

57.            value="org.apache.axis.transport.http.QSListHandler" />  

58.        

wsdl"  

59.            value="org.apache.axis.transport.http.QSWSDLHandler" />  

60.        

method"  

61.            value="org.apache.axis.transport.http.QSMethodHandler" />  

62.      

63.  

64.      

65.          

66.              

67.          

68.      

69.  

xmlversion="1.0"encoding="UTF-8"?

>

//xml.apache.org/axis/wsdd/"

xmlns:

java="http:

//xml.apache.org/axis/wsdd/providers/java">

value="false"/>

value="org.apache.axis.attachments.AttachmentsImpl"/>

org.apache.axis.handlers.JWSHandler">

org.apache.axis.handlers.JWSHandler">

type="java:

org.apache.axis.transport.local.LocalResponder"/>

type="java:

org.apache.axis.handlers.http.URLMapper"/>

type="java:

org.apache.axis.handlers.SimpleAuthenticationHandler"/>

MSG">

http:

//xml.apache.org/axis/wsdd/

RPC">

--�����Զ�����-->

RPC">

type="java:

org.apache.axis.handlers.http.HTTPAuthHandler"/>

list"

value="org.apache.axis.transport.http.QSListHandler"/>

wsdl"

value="org.apache.axis.transport.http.QSWSDLHandler"/>

method"

value="org.apache.axis.transport.http.QSMethodHandler"/>

  web.xml文件中的配置如下

Xml代码

1.

xml version="1.0" encoding="UTF-8"?

>  

2.

3.    xmlns:

xsi="http:

//www.w3.org/2001/XMLSchema-instance"  

4.    xsi:

schemaLocation="   

5.      

6.      

7.          

8.            org.apache.axis.transport.http.AxisHTTPSessionListener  

9.          

10.      

11.  

12.      

13.        AxisServlet  

14.        Apache-Axis Servlet  

15.          

16.            org.apache.axis.transport.http.AxisServlet  

17.          

18.      

19.  

20.      

21.        AdminServlet  

22.        Axis Admin Servlet  

23.          

24.            org.apache.axis.transport.http.AdminServlet  

25.          

26.        100  

27.      

28.  

29.      

30.        SOAPMonitorService  

31.        SOAPMonitorService  

32.          

33.            org.apache.axis.monitor.SOAPMonitorService  

34.          

35.          

36.            SOAPMonitorPort  

37.            5001  

38.          

39.        100  

40.      

41.  

42.      

43.        AxisServlet  

44.        /servlet/AxisServlet  

45.      

46.  

47.      

48.        AxisServlet  

49.        *.jws  

50.      

51.  

52.      

53.        AxisServlet  

54.        /services/*  

55.      

56.  

57.      

58.        SOAPMonitorService  

59.        /SOAPMonitor  

60.      

61.      

62.        index.jsp  

63.      

64.  

xmlversion="1.0"encoding="UTF-8"?

>

xmlns:

xsi="http:

//www.w3.org/2001/XMLSchema-instance"

xsi:

schemaLocation="

org.apache.axis.transport.http.AxisHTTPSessionListener

AxisServlet

Apache-AxisServlet

org.apache.axis.transport.http.AxisServlet

AdminServlet

AxisAdminServlet

org.apache.axis.transport.http.AdminServlet

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 解决方案 > 学习计划

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1