Server:
//1.创建发布服务的工厂JaxWsServerFactoryBean factoryBean=new JaxWsServerFactoryBean();//2.设置服务地址factoryBean.setAddress("http://localhost:8888/book");//3.设置服务接口,发布的服务factoryBean.setServiceClass(BookService.class);//4。设置服务实现factoryBean.setServiceBean(new BookServiceImpl());//5.创建服务并启动Server server=factoryBean.create();server.start();
Client:
//1.代理服务工厂JaxWsProxyFactoryBean factoryBean=new JaxWsProxyFactoryBean();//2.设置portfactoryBean.setAddress("http://localhost:8888/book?wsdl");//3.服务实现factoryBean.setServiceClass(BookService.class);//4.创建客户端BookService service=(BookService)factoryBean.create();
Cxf和SpringMVC整合
server端:
web.xml的配置:
encodingFilter org.springframework.web.filter.CharacterEncodingFilter encoding UTF-8 forceEncoding true encodingFilter /* cxf org.apache.cxf.transport.servlet.CXFServlet config-location classpath:spring-cxf.xml 1 cxf /ws/*
Server端的springmvc配置:
Client端的配置:










