欢迎来到天天文库
浏览记录
ID:37905895
大小:75.54 KB
页数:8页
时间:2019-06-02
《WebService笔记》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、发布服务的几种方式:1、纯JDK发布ProjectManagerprojectManager=newProjectManagerImpl();Stringaddress="http://localhost:8080/ProjectManager";//参数1服务的发布地址,参数2服务的实现者Endpoint.publish(address,projectManager);2、使用JaxServiceFactoryBean发布CXF的web服务,需要CXF框架jar包必须加入WebService注解,如果不加,虽然不报错,但是
2、所有的方法都无法暴露.与父类ServerFactoryBean发布方式相同JaxWsServerFactoryBeanbean=newJaxWsServerFactoryBean();bean.setAddress("http://localhost:8080/cxfhello");bean.setServiceClass(HelloServiceI.class);bean.setServiceBean(newHelloServiceImpl());//加入请求的消息拦截器bean.getInInterceptors().a
3、dd(newLoggingInInterceptor());//加入输出的消息拦截器bean.getOutInterceptors().add(newLoggingOutInterceptor());bean.create();System.out.println("helloServiceready...");3、使用spring+Servlet在tomcat中发布:cxf-servlet-spring.xml配置文件中的内容4、http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"xmlns:jaxws="http://cxf.apache.org/jaxws"xsi:schemaLocation="http://cxf.apache.org/transports/http/5、configurationhttp://cxf.apache.org/schemas/configuration/http-conf.xsdhttp://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://cxf.apache.org/jaxwshttp://cxf.apache.org/schemas/jaxws.xsd">7、"HelloService"implementor="com.lwl.ee.HelloService"address="/hello">8、interceptor.LoggingOutInterceptor">
4、http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"xmlns:jaxws="http://cxf.apache.org/jaxws"xsi:schemaLocation="http://cxf.apache.org/transports/http/
5、configurationhttp://cxf.apache.org/schemas/configuration/http-conf.xsdhttp://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://cxf.apache.org/jaxwshttp://cxf.apache.org/schemas/jaxws.xsd">7、"HelloService"implementor="com.lwl.ee.HelloService"address="/hello">8、interceptor.LoggingOutInterceptor">
7、"HelloService"implementor="com.lwl.ee.HelloService"address="/hello">8、interceptor.LoggingOutInterceptor">
8、interceptor.LoggingOutInterceptor">
此文档下载收益归作者所有