<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> <!--
cxf-rt-core-2.1.3.jar
cxf-rt-bindings-soap-2.1.3.jar
cxf-rt-transports-http-2.1.3.jar
-->
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" /> <jaxws:endpoint id="helloWorld" implementor="org.apache.cxf.HelloWorldImpl"
address="/HelloWorld" /> </beans>

1. import

cxf.xml 位于 cxf-rt-core-2.1.3.jar

<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:foo="http://cxf.apache.org/configuration/foo"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl"/>
<bean id="org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor" class="org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor"/>
<bean id="org.apache.cxf.bus.spring.Jsr250BeanPostProcessor" class="org.apache.cxf.bus.spring.Jsr250BeanPostProcessor"/>
<bean id="org.apache.cxf.bus.spring.BusExtensionPostProcessor" class="org.apache.cxf.bus.spring.BusExtensionPostProcessor"/> <bean id="org.apache.cxf.resource.ResourceManager" class="org.apache.cxf.bus.resource.ResourceManagerImpl">
<property name="resolvers">
<list>
<bean class="org.apache.cxf.resource.ClasspathResolver"/>
<bean class="org.apache.cxf.resource.ClassLoaderResolver"/>
<bean class="org.apache.cxf.bus.spring.BusApplicationContextResourceResolver"/>
</list>
</property>
<property name="bus" ref="cxf"/>
</bean>
<bean id="org.apache.cxf.configuration.Configurer"
class="org.apache.cxf.configuration.spring.ConfigurerImpl">
</bean> <bean id="org.apache.cxf.binding.BindingFactoryManager" class="org.apache.cxf.binding.BindingFactoryManagerImpl">
<property name="mapProvider">
<bean class="org.apache.cxf.configuration.spring.SpringBeanMap">
<property name="type" value="org.apache.cxf.binding.BindingFactory"/>
<property name="idsProperty" value="activationNamespaces"/>
</bean>
</property>
<property name="bus" ref="cxf"/>
</bean> <bean id="org.apache.cxf.transport.DestinationFactoryManager" class="org.apache.cxf.transport.DestinationFactoryManagerImpl">
<property name="mapProvider">
<bean class="org.apache.cxf.configuration.spring.SpringBeanMap">
<property name="type" value="org.apache.cxf.transport.DestinationFactory"/>
<property name="idsProperty" value="transportIds"/>
</bean>
</property>
<property name="bus" ref="cxf"/>
</bean> <bean id="org.apache.cxf.transport.ConduitInitiatorManager" class="org.apache.cxf.transport.ConduitInitiatorManagerImpl">
<property name="mapProvider">
<bean class="org.apache.cxf.configuration.spring.SpringBeanMap">
<property name="type" value="org.apache.cxf.transport.ConduitInitiator"/>
<property name="idsProperty" value="transportIds"/>
</bean>
</property>
<property name="bus" ref="cxf"/>
</bean> <bean id="org.apache.cxf.wsdl.WSDLManager" class="org.apache.cxf.wsdl11.WSDLManagerImpl">
<property name="bus" ref="cxf"/>
</bean> <bean id="org.apache.cxf.phase.PhaseManager" class="org.apache.cxf.phase.PhaseManagerImpl"> </bean> <bean id="org.apache.cxf.workqueue.WorkQueueManager" class="org.apache.cxf.workqueue.WorkQueueManagerImpl">
<property name="bus" ref="cxf"/>
</bean> <bean id="org.apache.cxf.buslifecycle.BusLifeCycleManager" class="org.apache.cxf.buslifecycle.CXFBusLifeCycleManager">
<property name="bus" ref="cxf"/>
</bean> <bean id="org.apache.cxf.endpoint.ServerRegistry" class="org.apache.cxf.endpoint.ServerRegistryImpl">
<property name="bus" ref="cxf"/>
</bean> <bean id="org.apache.cxf.endpoint.ServerLifeCycleManager" class="org.apache.cxf.endpoint.ServerLifeCycleManagerImpl"/>
<bean id="org.apache.cxf.endpoint.ClientLifeCycleManager" class="org.apache.cxf.endpoint.ClientLifeCycleManagerImpl"/> <bean id="org.apache.cxf.transports.http.QueryHandlerRegistry" class="org.apache.cxf.transport.http.QueryHandlerRegistryImpl">
<property name="bus" ref="cxf"/>
<property name="queryHandlers">
<list>
<bean class="org.apache.cxf.transport.http.WSDLQueryHandler">
<property name="bus" ref="cxf"/>
</bean>
</list>
</property>
</bean> <bean id="org.apache.cxf.endpoint.EndpointResolverRegistry" class="org.apache.cxf.endpoint.EndpointResolverRegistryImpl">
<property name="bus" ref="cxf"/>
</bean>
<bean id="org.apache.cxf.headers.HeaderManager" class="org.apache.cxf.headers.HeaderManagerImpl">
<property name="bus" ref="cxf"/>
</bean>
<bean id="org.apache.cxf.catalog.OASISCatalogManager" class="org.apache.cxf.catalog.OASISCatalogManager">
<property name="bus" ref="cxf"/>
</bean> <bean id="org.apache.cxf.endpoint.ServiceContractResolverRegistry" class="org.apache.cxf.endpoint.ServiceContractResolverRegistryImpl">
<property name="bus" ref="cxf"/>
</bean>
</beans>

定义了id 是 cxf 的bean ,以供其他bean 引用。

定义了其他bean

cxf-extension-soap.xml 位于cxf-rt-bindings-soap-2.1.3.jar

<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
--> <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:foo="http://cxf.apache.org/configuration/foo"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="org.apache.cxf.binding.soap.SoapBindingFactory"
class="org.apache.cxf.binding.soap.SoapBindingFactory" lazy-init="true">
<property name="activationNamespaces">
<set>
<value>http://schemas.xmlsoap.org/soap/</value>
<value>http://schemas.xmlsoap.org/wsdl/soap/</value>
<value>http://schemas.xmlsoap.org/wsdl/soap12/</value>
<value>http://www.w3.org/2003/05/soap/bindings/HTTP/</value>
<value>http://schemas.xmlsoap.org/wsdl/soap/http</value>
</set>
</property>
<property name="bus" ref="cxf"/>
</bean> <bean class="org.apache.cxf.binding.soap.SoapTransportFactory"
id="org.apache.cxf.binding.soap.SoapTransportFactory"
lazy-init="true">
<property name="transportIds">
<list>
<value>http://schemas.xmlsoap.org/soap/</value>
<value>http://schemas.xmlsoap.org/wsdl/soap/</value>
<value>http://schemas.xmlsoap.org/wsdl/soap12/</value>
</list>
</property>
<property name="bus" ref="cxf"/>
</bean> <bean id="org.apache.cxf.binding.soap.customEditorConfigurer"
class="org.springframework.beans.factory.config.CustomEditorConfigurer">
<property name="customEditors">
<map>
<entry key="org.apache.cxf.binding.soap.SoapVersion">
<bean class="org.apache.cxf.binding.soap.SoapVersionEditor"/>
</entry>
</map>
</property>
</bean>
</beans>

cxf-servlet.xml 位于 cxf-rt-transports-http-2.1.3.jar

<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:foo="http://cxf.apache.org/configuration/foo"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean class="org.apache.cxf.transport.servlet.ServletTransportFactory"
id="org.apache.cxf.transport.servlet.ServletTransportFactory">
<property name="bus" ref="cxf"/>
<property name="transportIds">
<set>
<value>http://cxf.apache.org/bindings/xformat</value>
<value>http://schemas.xmlsoap.org/soap/http</value>
<value>http://schemas.xmlsoap.org/wsdl/http/</value>
<value>http://schemas.xmlsoap.org/wsdl/soap/http</value>
<value>http://www.w3.org/2003/05/soap/bindings/HTTP/</value>
<value>http://cxf.apache.org/transports/http/configuration</value>
</set>
</property>
</bean>
</beans>

2. jaxws

http://cxf.apache.org/schemas/jaxws.xsd

这个xml语法定义中提供了三个:

  • <jaxws:endpoint></jaxws:endpoint>
  • <jaxws:server></jaxws:server>
  • <jaxws:client></jaxws:client>

endpoint 与 server 的区别

cxf的发布方式↓

package ws.run;

import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.JaxWsServerFactoryBean; import cn.zno.ws.service.CleanService;
import cn.zno.ws.serviceImpl.CleanServiceImpl; public class Run { public static void main(String[] args) {
CleanServiceImpl implementor = new CleanServiceImpl();
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
svrFactory.setServiceClass(CleanService.class);
svrFactory.setAddress("http://localhost:9000/clean");
svrFactory.setServiceBean(implementor);
svrFactory.getInInterceptors().add(new LoggingInInterceptor());
svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
svrFactory.create();
}
}

标准的发布服务方式↓

package ws.run;

import javax.xml.ws.Endpoint;

import cn.zno.ws.serviceImpl.CleanServiceImpl;

public class Run {

    public static void main(String[] args) {
Endpoint.publish("http://localhost:9000/clean", new CleanServiceImpl());
}
}

配置 cxf-ws spring bean 文件的更多相关文章

  1. 配置 cxf-rs spring bean 文件

    http://cxf.apache.org/schemas/jaxrs.xsd http://cxf.apache.org/docs/restful-services.html 示例: <?xm ...

  2. Spring Bean几种注入方式——setter(常用),构造器,注入内部Bean,注入集合,接口...

    依赖注入分为三种方式: 1.1构造器注入 构造器通过构造方法实现,构造方法有无参数都可以.在大部分情况下我们都是通过类的构造器来创建对象,Spring也可以采用反射机制通过构造器完成注入,这就是构造器 ...

  3. 【Spring】IoC容器 - Spring Bean作用域Scope(含SpringCloud中的RefreshScope )

    前言 上一章学习了[依赖来源],本章主要讨论SpringBean的作用域,我们这里讨论的Bean的作用域,很大程度都是默认只讨论依赖来源为[Spring BeanDefinition]的作用域,因为在 ...

  4. Spring配置bean文件的底层实现方式

    首先 bean文件如下: <beans> <bean id="date" class="java.util.Date"></bea ...

  5. Spring基础——在Spring Config 文件中配置 Bean

    一.基于 XML 的 Bean 的配置——通过全类名(反射) <bean <!-- id: bean 的名称在IOC容器内必须是唯一的若没有指定,则自动的将全限定类名作为 改 bean 的 ...

  6. Spring bean工厂配置头文件

    命名 beans.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns=" ...

  7. CXF和spring整合遇到的问题:No bean named 'cxf' is defined

    今天在做ws和spring整合的时候,很不幸的遇到了这个问题,百度了好久,竟然没人遇到这个问题,后来谷歌了一下,都是遇到这个问题的了...在看到一篇文章中提到了cxf.xml,所以我果断的打开这个配置 ...

  8. webservice 服务端例子+客户端例子+CXF整合spring服务端测试+生成wsdl文件 +cxf客户端代码自动生成

    首先到CXF官网及spring官网下载相关jar架包,这个不多说.webservice是干嘛用的也不多说. 入门例子 模拟新增一个用户,并返回新增结果,成功还是失败. 大概的目录如上,很简单. Res ...

  9. [原创]java WEB学习笔记98:Spring学习---Spring Bean配置及相关细节:如何在配置bean,Spring容器(BeanFactory,ApplicationContext),如何获取bean,属性赋值(属性注入,构造器注入),配置bean细节(字面值,包含特殊字符,引用bean,null值,集合属性list map propert),util 和p 命名空间

    本博客的目的:①总结自己的学习过程,相当于学习笔记 ②将自己的经验分享给大家,相互学习,互相交流,不可商用 内容难免出现问题,欢迎指正,交流,探讨,可以留言,也可以通过以下方式联系. 本人互联网技术爱 ...

随机推荐

  1. 转载:mysql数据同步redis

    from: http://www.cnblogs.com/zhxilin/archive/2016/09/30/5923671.html 在服务端开发过程中,一般会使用MySQL等关系型数据库作为最终 ...

  2. 关于U3D场景烘焙的一个想法

    U3D进行场景烘焙时,发现阴影无法选择烘焙质量,其实想一下也合理,毕竟是烘焙,是将光照与阴影信息保存到lightmap中,因此阴影的质量取决于光照贴图的精度, 就算光照贴图再大,也远不可能达到实时光照 ...

  3. nmap扫描工具

    1.NMap工具 主要功能:探测主机是否在线.扫描主机开放端口和嗅探网络服务,用于网络探测和安全扫描. NMap支持很多扫描技术,例如:UDP.TCPconnect().TCPSYN(半开扫描).ft ...

  4. js获取或判断任意数据类类型的通用方法(getDataType)和将NodeList转为数组(NodeListToArray)

    function getDataType(any){ /* (1) Object.prototype.toString.call 方法判断类型: 优点:通用,返回"[object Strin ...

  5. 【Java】JavaIO(二)、节点流

    一.InputStream & outputStream Java字节流主要是以InputStream (输入流),outputStream(输出流)为基类,本身是抽象类不能创建实例,但是是字 ...

  6. zabbix出现中文不能选的情况

    像这里一样,有些选项是选不了的,这个时候我们要做的第一步就是,找到这个配置文件. 如果不知道在哪里的话可以用find命令查找. sudo find / -name locales.inc.php 找到 ...

  7. sqldatareader无法得到output参数的解决

    只需要在所有的sqldatareader结束后,加上一句就可以得到输出参数了. sdr.Close(); Object ObjCount = cmd.Parameters["@Count_P ...

  8. UNITY中的MOUSE点击事件的判断和AS3中的异同

    UNITY - 在UPDATE中轮询检测 Update() { if(Input.GetButton("Fire1") } AS3 - 事件监听 addEventListener. ...

  9. 【校招面试 之 C/C++】第19题 C++ STL(一)

      容器名称 说明 vector 典型的序列容器,C++标准严格要求次容器的实现内存必须是连续的,唯一可以和标准C兼容的stl容器,任意元素的读取.修改具有常数时间复杂度,在序列尾部进行插入.删除是常 ...

  10. php 使用PHPExcel 导出数据为Excel

    <?php require_once 'PHPExcel/Classes/PHPExcel.php'; /** * 导出数据为Excel * @param array $fieldArr 标题数 ...