2)pom.xml添加依赖以及相关插件
<project xmlns=“http://maven.apache.org/POM/4.0.0”
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=“http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd”>
4.0.0
com.itzheng
cxfServer
0.0.1-SNAPSHOT
war
org.apache.cxf
cxf-rt-frontend-jaxws
3.1.10
org.apache.cxf
cxf-rt-transports-http
3.1.10
org.springframework
spring-beans
4.2.4.RELEASE
org.springframework
spring-web
4.2.4.RELEASE
org.apache.maven.plugins
maven-compiler-plugin
2.3.2
1.71.7
org.apache.tomcat.maven
tomcat7-maven-plugin
9090
3)编写服务接口和服务类
IWeatherService
package com.itzheng.cxfserver;
import javax.jws.WebService;
/*
- 天气服务接口
*/
@WebService
public interface IWeatherService {
//根据城市返回天气信息
String info(String city);
}
WeatherService
public class WeatherService implements IWeatherService { <