`
mingnianshimanian
  • 浏览: 39603 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

cxf+web service(四)cxf+spring集成

阅读更多

客户端

public class Client {

	private Client(){}
	
	public static void main(String[] args) {
		ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext-client.xml");
        HelloWorld hw = (HelloWorld) context.getBean("client");
        String response = hw.zhuce("piter", "123456");
        System.out.println(response);
	}
}

 客户端配置文件,这里面配置代理工厂,地址,暴露的服务接口.这里也可以直接在客户端代码里面使用JaxWsProxyFactoryBean来发布

 <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"/>

    <bean id="client" class="com.cxf.test.HelloWorld" factory-bean="clientFactory" factory-method="create" />

    <bean id="clientFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
        <property name="serviceClass" value="com.cxf.test.HelloWorld" />
        <property name="address" value="http://localhost:8080/cxf/ws/HelloWorld" />
    </bean>

 然后在spring.xml中加入接口的配置

<!-- Import Apache CXF Bean Definition -->
    <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="com.cxf.test.HelloWorldImpl" 
    	address="/HelloWorld"/>

 OK,最后在浏览器输入http://localhost:8080/cxf/ws,如下图,发布成功!



 运行客户端main方法,控制台输出,注册成功.

  • 大小: 36.6 KB
0
0
分享到:
评论

相关推荐

    CXF+Spring+JPA+JAX_WS API +Tomcat

    Java web service 入门示例,使用 JAX_WS API 开发,使用 CXF 发布,集成 Spring ,Spring orm 基于 JPA 开发 DAO, 并使用 Spring data jpa 简化 DAO 实现。

    ssm+cxf(基于Maven开发的ssm框架集成cxf发布web service服务)

    源码里面包含了了一个简单的插入功能,主要是为了测试mybatis是否连接上数据库的时候写的测试类,作为一个刚学java,被抓壮丁的写服务器端的妹子,我只想说,画了我3周...如题,基于maven项目的ssm框架和cxf框架的整合。

    Springboot整合CXF发布Web service和客户端调用(用户和密码验证)

    Springboot整合CXF发布Web service和客户端调用(用户和密码验证)打开及用

    web service cxf 2.7.5 与spring 3.0 集成

    webService实现 cxf2.7.5 与 spring3.0集成 完整流程,内涵全部jar ,下载集合运行

    web service cxf spring集成

    完整的代码详解,让您更快的上手 jar包代码都是测试过的客户端和服务端

    cxf(jax-ws)+spring+hibernate整合包

    logging-1.1.1.jar,cxf-2.7.6.jar,cxf-manifest.jar,cxf-services-sts-core-2.7.6.jar,cxf-services-ws-discovery-api-2.7.6.jar,cxf-services-ws-discovery-service-2.7.6.jar,cxf-services-wsn-api-2.7.6.jar,cxf-...

    CXF WebService整合Spring示例工程代码demo

    CXF WebService整合Spring示例工程代码demo可以直接导入eclipse。参照网页http://www.cnblogs.com/hoojo/archive/2011/03/30/1999563.html 完成的webService服务提供。 大致步骤: 1.引入cxf和其他需要的jar包,(本...

    用cxf开发webservice

    Apache CXF是一个开源的Service框架,它实现了JCP与Web Service中一些重要标准。CXF简化了构造,集成,面向服务架构(SOA)业务组件与技术的灵活复用。在CXF中,Service使用WSDL标准定义并能够使用各种不同的消息格式...

    spring集成cxf(webservice)

    Web Service是一种构建应用程序的普遍模型,可以在任何支持网络通信的操作系统中实施运行;它是一种新的webs应用程序分支,是自包含、自描述、模块 化的应用,可以发布、定位、通过web调用。

    spring+hibernate+struts2+webservice示例

    这是个采用apache cxf实现webservice的示例,主要由spring整合hibernate、struts2实现webservice,里面struts2用到得较少……对于学习很有帮助,另外我觉得若是初学者,不过采用那方式,现在按照套方案做熟练后再去...

    web_service_spring_c:Spring4.3.10集成Apache CXF 3.3客户端二进制文件

    web_service_spring_c Spring4.3.10集成Apache CXF 3.3客户端二进制文件

    apache-cxf-2.1.1.zip

    非常流行的web service框架,与spring集成,非常简单。

    apache-cxf-2.3.0-src

    Apache CXF 是一个开源的 Services 框架,CXF 帮助您利用 Frontend 编程 API 来构建和开发 Services ,像 JAX-WS 。这些 Services 可以支持多种协议,比如:SOAP、XML/HTTP、RESTful HTTP 或者...Spring 进行无缝集成。

    Web Service 接口的发布与调用

    1.采用cxf集成Spring实现webservice接口的发布。 2.(调用一)用eclipse根据wsdl连接自动生成java代码实现接口的调用。 3.(调用二)用axis2实现接口调用。 4.开发环境:eclipse+jdk1.8+tomcat8.5

    HelloWorldService.zip_xml/soap/webservice_Java_

    使用CXF与Spring集成编写的Web service 例子。

    Java源码 SpringMVC Mybatis Shiro Bootstrap Rest Webservice

    1. Springmvc + Mybatis集成、SpringSecurity权限控制、Spring AOP事务处理。 2. Wink Rest服务、Webservice服务:jaxws、CXF等 3. IO 流上传下载文件,多线程操作 4. 发送邮件,配置邮件服务器,发基于html、纯...

Global site tag (gtag.js) - Google Analytics