使用axis2创建webservice
这个方式创建的webservice可以和web项目放到同一个工程下。 创建webservice服务,所需要的jar包如下: axiom-api-1.2.8.jar 一 创建java web项目 ? package com.geng.webservice; public class HelloService { public String getName(String xml){ if(xml!=null){ System.out.println(xml); } return "hello webservice"; } public String getAge(String xml){ return "test"; } } ? 四 配置web.xml文件 <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
display-name>testWebservice</welcome-file-listwelcome-file>index.html>index.htm>index.jsp>default.html>default.htm>default.jspservlet <servlet-name>AxisServletservlet-class>org.apache.axis2.transport.http.AxisServletload-on-startup>1servlet-mappingurl-pattern>/services/*web-app>
|