1、简单axis2例子实现Web Service学习之axis看着网上的资料学习了一下,做点笔记以防以后忘记。一、准备工作: 到axis官方网站下载相应的jar包,我下的是1.4final版。 http:/ws.apache.org/axis/二、建立项目: 直接在MyEclipse中建立了一个web项目。将相应的jar包拷贝到lib文件夹下三、创建一个WebService服务 直接创建一个类HelloClient.javaJava代码 1. packagecom; 2. 3. publicclassHelloServer 4. publicStringsayHello(Stringname) 5
2、. returnHello+name; 6. 7. package com;public class HelloServer public String sayHello(String name) return Hello + name; axis支持两种方式创建,一种是将编写好的java文件改为*.jws文件。个人觉得这样不好,所以就用另外一种,采用在server-config.xml文件中配置的方式。注意:该文件位置为WEB-INF目录下Xml代码 1. 2. 4. 5. 6. 8. 9. 10. 11. 12. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23
3、. 24. 25. 26. 27. 29. 31. 33. 34. 35. 36. 37. 38. http:/xml.apache.org/axis/wsdd/39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 55. 56. 58. 60. 62. 63. 64. 65. 66. 67. 68. 69. http:/xml.apache.org/axis/wsdd/ web.xml文件中的配置如下Xml代码 1. 2. web-appversion=2.5xmlns=3. xmlns:xsi=http:/www.w3.or
4、g/2001/XMLSchema-instance4. xsi:schemaLocation= 5. 6. 7. 8. org.apache.axis.transport.http.AxisHTTPSessionListener 9. 10. 11. 12. 13. AxisServlet14. Apache-AxisServlet15. 16. org.apache.axis.transport.http.AxisServlet 17. 18. 19. 20. 21. AdminServlet22. AxisAdminServlet23. 24. org.apache.axis.transp
5、ort.http.AdminServlet 25. 26. 10027. 28. 29. 30. SOAPMonitorService31. SOAPMonitorService32. 33. org.apache.axis.monitor.SOAPMonitorService 34. 35. 36. SOAPMonitorPort37. 500138. 39. 10040. 41. 42. 43. AxisServlet44. /servlet/AxisServlet45. 46. 47. 48. AxisServlet49. *.jws50. 51. 52. 53. AxisServlet
6、54. /services/*55. 56. 57. 58. SOAPMonitorService59. /SOAPMonitor60. 61. 62. index.jsp63. 64. web-app version=2.5 xmlns= xmlns:xsi=http:/www.w3.org/2001/XMLSchema-instance xsi:schemaLocation= org.apache.axis.transport.http.AxisHTTPSessionListener AxisServlet Apache-Axis Servlet org.apache.axis.transport.http.AxisServlet AdminServlet Axis Admin Servlet org.apache.axis.transport.http.AdminServlet
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1