转自 http://blog.csdn.net/fhd001
<?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">
<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="cxf.server.HelloWorldImpl" address="/HelloWorld" /> -->
<!-- 第二种方式 -->
<!--
<bean id="helloWorldImpl" class="cxf.server.HelloWorldImpl"/>
<jaxws:endpoint id="helloWorld" implementor="#helloWorldImpl" address="/HelloWorld"/>
-->
<!-- 第三种方式 -->
<jaxws:server id="helloWorld" serviceClass="cxf.server.HelloWorld" address="/HelloWorld">
<jaxws:serviceBean>
<bean class="cxf.server.HelloWorldImpl"/>
</jaxws:serviceBean>
</jaxws:server>
</beans>
这是一个加入了interceptor或feature功能的配置实例。
<?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">
<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" />
<!--
endpointName 属性 就是 wsdl:port的name属性,serviceName属性就是wsdl:service的name属性 ,
其实可以在java代码中用注解进行配置
-->
<jaxws:endpoint id="helloWorld"
implementor="cxf.server.HelloWorldImpl"
address="/HelloWorld"
endpointName="e:HelloWorldEP"
serviceName="s:HelloWorldSV"
xmlns:e="http://service.jaxws.cxf.apache.org/endpoint"
xmlns:s="http://service.jaxws.cxf.apache.org/service">
<jaxws:inInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
</jaxws:inInterceptors>
<jaxws:outInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
</jaxws:outInterceptors>
<!--
<jaxws:features>
<bean class="org.apache.cxf.feature.LoggingFeature"/>
</jaxws:features>
-->
</jaxws:endpoint>
</beans>
这是一个比较简单的CXF客户端配置,后面还有复杂一些的。
<?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">
<!-- 第一种方式 -->
<!--
<bean id="client" class="cxf.server.HelloWorld" factory-bean="clientFactory" factory-method="create" />
<bean id="clientFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
<property name="serviceClass" value="cxf.server.HelloWorld" />
<property name="address" value="http://localhost:8085/java_first_spring_support1/service/HelloWorld" />
</bean>
-->
<!-- 第二种方式 -->
<jaxws:client id="client"
address="http://localhost:8085/java_first_spring_support1/service/HelloWorld"
serviceClass="cxf.server.HelloWorld" />
</beans>
分享到:
相关推荐
使用cxf+spring框架开发webservice的客户端与服务端代码,用于连接两个项目
cxf webservice 实例(包括服务端及客户端代码),亲测可用,项目采用spring与cxf结合的,附件解压后看到两个项目,分部是服务端项目和客户端项目,启动tomcat服务器部署后,通过客户端右键运行java 的 mian方法代码...
CXF&spring实例,服务端客户调,spring配置
实现了客户端和服务端,客户端添加header服务端获取验证!
实例分为两个工程,分别是web service的服务端和客户端。 实例采用cxf和spring的结合来实现web service的应用,经过测试可用,其中服务端经过测试可以用axis2的web service客户端访问。
cxf webservice 实例(包括服务端及客户端代码),亲测可用,项目采用spring与cxf结合的,附件解压后看到两个项目,分部是服务端项目和客户端项目,启动tomcat服务器部署后,通过客户端右键运行java 的 mian方法代码...
webservice客户端与服务端实例,可以运行,java代码编写,发布方式有两种,1为cxf集成到spring 通过tomcat 发布,2为endpoint方式以main方法运行。 提供了返回常用的基本数据类型和map,list,javabean 4个接口服务 ...
本文档中有完整的服务端和客户端,cxf和spring集成在一起, 从pom.xml依赖包,到web.xml配置,然后spring的配置文件,再到接口,实现类,类型转换,完成的实例,由于公司业务需求花了两天完成
用CXF+Spring实现的一个WebService示例型实例,分为两个工程:WebService服务端工程和WebService客户端工程,直接导入MyEclipse中即可运行。
主要介绍了Spring Boot 实现Restful webservice服务端示例代码,非常不错,具有参考借鉴价值,需要的朋友可以参考下
Google为ndroid平台开发Web Service...好了,现在我们就可以进行新建项目来进行测试了,首先我们先建立java服务端,这里的一些前期准备我就不说了(比如与spring的整合等示例), 由于这里重点是android客户端,java服务