步骤
1、创建Web Service Project
2、创建需要提供服务的接口 如:
3、实现该接口 如:
4、修改services.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xfire.codehaus.org/config/1.0">
<service>
<!--服务的名称-->
<name>cityWeather</name>
<!--服务的命名空间(为了保证唯一性,请使用域名)-->
<namespace>www.lwm.com/cityWeather</namespace>
<!--服务的接口-->
<serviceClass>com.lwm.dao.IWeatherService</serviceClass>
<!--服务的实现类-->
<implementationClass>com.lwm.dao.impl.WeatherServiceImpl</implementationClass>
</service>
</beans>
5、部署程序和测试程序
测试是否成功请在浏览器中输入:http://服务器地址/项目名称/services
如:http://localhost:8080/MyServiceDemo/services
出现该图片即表示成功
注:web.xml已经在新建项目时自动配置过了。