CXF 集合spring开发webservice
一,首先是准备工作,所需要的jar包:
cxf-2.4.1.jar
neethi-3.0.0.jar
xmlschema-core-2.0.jar
wsdl4j-1.6.2.jar
geronimo-activation_1.1_spec-1.1.jar
geronimo-annotation_1.0_spec-1.1.1.jar
geronimo-javamail_1.4_spec-1.7.1.jar
geronimo-servlet_3.0_spec-1.0.jar
geronimo-ws-metadata_2.0_spec-1.1.3.jar
jaxb-api-2.2.1.jar
jaxb-impl-2.2.1.1.jar
jaxb-xjc-2.2.1.1.jar
jetty-http-7.4.2.v20110526.jar
jetty-server-7.4.2.v20110526.jar
jetty-util-7.4.2.v20110526.jar
saaj-api-1.3.jar
saaj-impl-1.3.2.jar
wss4j-1.6.1.jar
xmlbeans-2.4.0.jar
红色部分是不集成spring开发调试需要用到的jar包,spring需要的包一般spring工程都会有,这里不做说明。
二,创建service接口和实现类
接口:
二,配置web.xml过滤.
在工程的web.xml添加如下内容:
将上面的文件引入到applicationContext.xml中:import javax.xml.ws.Endpoint;import com.***.***.webservice.test.impl.HelloWordImpl;public class WebServiceApp {/** * @param args */public static void main(String[] args) {System.out.println("web service start"); HelloWordImpl implementor= new HelloWordImpl(); String address="http://localhost:8080/helloWorld"; Endpoint.publish(address, implementor); System.out.println("web service started");}}