`
zhangwei_david
  • 浏览: 474752 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

CXF WebService (二)

 
阅读更多

      在CXF WebService (一) 中可以发现发布一个WS 服务还是很简单的,但是我们在Spring 中发布一个WS还有更简单的方法。

     

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:p="http://www.springframework.org/schema/p" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:aop="http://www.springframework.org/schema/aop" xmlns:jee="http://www.springframework.org/schema/jee"
	xmlns:task="http://www.springframework.org/schema/task" xmlns:util="http://www.springframework.org/schema/util"
	xmlns:jaxws="http://cxf.apache.org/jaxws"
	xsi:schemaLocation="
		http://www.springframework.org/schema/beans
		http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
		http://www.springframework.org/schema/context
		http://www.springframework.org/schema/context/spring-context-3.0.xsd
		http://www.springframework.org/schema/aop 
		http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
		http://www.springframework.org/schema/tx
		http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
		http://www.springframework.org/schema/jee 
		http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
		http://www.springframework.org/schema/task  
        http://www.springframework.org/schema/task/spring-task-3.1.xsd  
        http://www.springframework.org/schema/util
        http://www.springframework.org/schema/util/spring-util-3.0.xsd
        http://cxf.apache.org/jaxws
        http://cxf.apache.org/schemas/jaxws.xsd
		">
	<context:annotation-config />
	<context:component-scan base-package="com.*.*"/>
	<!-- pool-size 是线程池的大小,queue-capacity 默认值是 Integer.MAX_VALUE  -->
	<task:executor id="executor" pool-size="100" />
	<task:scheduler id="scheduler" pool-size="10"/>
	<task:annotation-driven executor="executor" scheduler="scheduler"/>
	<bean id="studentBiz" class="com.cathy.demo.aop.biz.StudentBizImpl"/>  
    <bean id="beforeAdvice" class="com.cathy.demo.aop.BeforeAdvice"/>  
    <aop:config>  
          
        <aop:aspect id="myAspect" ref="beforeAdvice">  
            <aop:before pointcut="execution(* com.cathy.demo.aop.biz.*.*(..))"
                        method="before"/>
        </aop:aspect>  
          
    </aop:config>  
    
    <jaxws:endpoint id="helloWord" implementor="com.cathy.demo.cxf.impl.HelloWordImpl" address="http://localhost:8080/HelloWord"/>
</beans>

 

/**
 *
 * @author zhangwei
 * @version $Id: AsyncDemoTest.java, v 0.1 2014年9月26日 下午10:43:43 zhangwei Exp $
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath*:META-INF/spring/*.xml")
public class AsyncDemoTest {
    @Autowired
    private TestClient testClient;

    @Test
    public void testAsync() throws InterruptedException {
        testClient.operate();
        TimeUnit.MINUTES.sleep(5);
    }

}

 在浏览器中输入:http://localhost:8080/HelloWord?wsdl

<?xml version="1.0" encoding="UTF-8"?>

-<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://com.cathy.demo" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" targetNamespace="http://com.cathy.demo" name="HelloWordService">


-<wsdl:types>


-<xs:schema xmlns:tns="http://com.cathy.demo" targetNamespace="http://com.cathy.demo" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" elementFormDefault="unqualified">

<xs:element name="sayHello" type="tns:sayHello"/>

<xs:element name="sayHelloResponse" type="tns:sayHelloResponse"/>


-<xs:complexType name="sayHello">

<xs:sequence/>

</xs:complexType>


-<xs:complexType name="sayHelloResponse">

<xs:sequence/>

</xs:complexType>

</xs:schema>

</wsdl:types>


-<wsdl:message name="sayHelloResponse">

<wsdl:part name="parameters" element="tns:sayHelloResponse"> </wsdl:part>

</wsdl:message>


-<wsdl:message name="sayHello">

<wsdl:part name="parameters" element="tns:sayHello"> </wsdl:part>

</wsdl:message>


-<wsdl:portType name="HelloWord">


-<wsdl:operation name="sayHello">

<wsdl:input name="sayHello" message="tns:sayHello"> </wsdl:input>

<wsdl:output name="sayHelloResponse" message="tns:sayHelloResponse"> </wsdl:output>

</wsdl:operation>

</wsdl:portType>


-<wsdl:binding name="HelloWordServiceSoapBinding" type="tns:HelloWord">

<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>


-<wsdl:operation name="sayHello">

<soap:operation style="document" soapAction=""/>


-<wsdl:input name="sayHello">

<soap:body use="literal"/>

</wsdl:input>


-<wsdl:output name="sayHelloResponse">

<soap:body use="literal"/>

</wsdl:output>

</wsdl:operation>

</wsdl:binding>


-<wsdl:service name="HelloWordService">


-<wsdl:port name="HelloPort" binding="tns:HelloWordServiceSoapBinding">

<soap:address location="http://localhost:8080/HelloWord"/>

</wsdl:port>

</wsdl:service>

</wsdl:definitions>

 

分享到:
评论

相关推荐

    cxf WebService jar包(1)

    cxf WebService jar包

    CXF webservice+mybatis

    【标题】"CXF Webservice+Mybatis" 深度解析 在现代软件开发中,集成不同的技术栈以构建高效、可维护的系统是常见的做法。本篇将深入探讨如何利用Apache CXF作为Web服务框架,与Mybatis作为持久层框架进行整合,...

    cxf webservice demo

    此"CXF Webservice Demo"是一个实例,展示了如何使用CXF来创建和消费Web服务。CXF允许开发者通过SOAP(简单对象访问协议)和RESTful(Representational State Transfer)接口进行通信,支持多种协议和绑定,如HTTP、...

    实战Web+Service+with+CXF webservice快速入门

    实战Web+Service+with+CXF webservice快速入门 webservice快速入门

    mybatis+spring+cxf Webservice框架

    【标题】"mybatis+spring+cxf Webservice框架"是一个集成性的开发框架,它结合了三个主流的技术组件:MyBatis、Spring和Apache CXF,用于构建高效、灵活且易于维护的Web服务。MyBatis是一个优秀的持久层框架,Spring...

    CXF webservice 验证码接口

    使用jdk1.6、cxf2.3和tomcat开发的一个关于验证码的webservice接口,主要实现对手机验证码的验证。

    CXF webService 工具类

    - **MTOM/XOP(Message Transmission Optimization Mechanism/Inline Binary Data)**:CXF支持高效传输大容量二进制数据,提高服务性能。 - **安全性**:CXF提供了多种安全机制,如WS-Security、OAuth等,确保Web...

    CXF webservice Demo

    【CXF Webservice Demo】是基于Apache CXF框架的一个示例项目,用于演示如何使用CXF来创建和消费Web服务。Apache CXF是一个开源的Java框架,它允许开发者构建和集成Web服务,支持多种Web服务标准,如SOAP、RESTful ...

    maven项目 cxf webservice

    【标题】"maven项目 cxf webservice"指的是使用Maven构建的一个项目,该项目集成了Apache CXF框架来开发Web服务。Apache CXF是一个开源的Java框架,它允许开发者创建和消费各种Web服务,包括SOAP和RESTful服务。...

    C#动态调用CXF WEBSERVICE框架的共通类

    C#动态调用CXF WEBSERVICE框架共通类。

    webService(基于cxf)的完整例子

    例如,可以使用`@WebService`注解标记一个Java类为Web服务接口,并使用`@Path`注解来定义RESTful服务的URL路径。 4. **CXF服务部署**:CXF提供多种部署方式,包括独立服务器、Tomcat等应用服务器,以及Spring容器。...

    使用cxf webservice时容易出现的异常

    使用cxf webservice时容易出现的异常

    CXF WebService整合Spring代码(包含服务,客户端两个工程 和 文档)

    CXF WebService整合Spring代码(包含服务,客户端两个工程 和 文档) 需要视频的话,留邮箱

    CXF WebService 所需要的最少的jar包

    在这个主题中,我们将深入探讨CXF WebService所需的最小jar包集合,以及如何利用这些库来开发Web服务。 首先,CXF的核心功能依赖于一系列的jar包,这些jar包包含了处理不同协议、数据绑定、WS-Security等关键组件的...

    CXF webservice 示例工程(集成spring)

    本示例工程是基于CXF框架构建的一个Webservice应用,该应用集成了Spring框架,以实现更高效的服务管理和依赖注入。CXF是一个开源的Web服务框架,它允许开发者创建和部署SOAP和RESTful服务,同时也支持WS-*标准,如...

    cxf发布webservice示例

    webservice示例 springmvc+maven+cxf发布webservice 博客地址 http://blog.csdn.net/joe_storm/article/details/78839150

    CXF webservice初学笔记

    【CXF Webservice初学笔记】 在IT行业中,Web服务是一种允许不同系统之间进行通信和交换数据的方法。Apache CXF是一个流行的开源框架,用于构建和部署Web服务。本笔记将探讨CXF Webservice的基础知识,包括其核心...

    Java cxf开发webservice,分别有客户端和服务端

    2.用cxf开发webservice 3.这个服务端和客户端的小demo 在服务端 对外开放接口服务,然后在客户端 调用服务端的方法, 实现客户端(一个javaweb项目)对服务端(javaweb项目)方法的调用, 实际上就是发送和接收消息...

    spring+CXF实现WebService(http+https)

    2. **创建WebService**: 使用CXF,首先需要定义服务接口,通常是一个Java接口,然后提供其实现。Spring会自动扫描并注册这些服务。在Spring配置文件中,可以通过`&lt;jaxws:endpoint&gt;`标签来声明一个CXF Web服务,...

    java cxf webservice接口解决跨域问题

    Java CXF Webservice接口在处理Web服务时,可能会遇到跨域问题,这通常是由于浏览器的安全策略限制了不同源之间的通信。解决这个问题的关键在于理解和应用CORS(Cross-Origin Resource Sharing)机制。CORS允许...

Global site tag (gtag.js) - Google Analytics