• cxf框架使用(一)


    1.创建调用接口

    
    @WebService
    public interface IQueryBusinessService {
    
        
        public @WebResult(name="QueryBusinessReturn") QueryBusinessReturn queryBusinessByBID(@WebParam(name="businessid") String businessid);
        
        
        public @WebResult(name="QueryBusinessReturn") List<QueryBusinessReturn> queryBusinessByCustomer(@WebParam(name="BusinessCustomerQuery") BusinessCustomerQuery queryBusiness);
    }


    2.接口实现类

    3.spring整合

    <?xml version="1.0" encoding="UTF-8"?>
    <!-- START SNIPPET: beans -->
    <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="IQueryBusinessService" 
            implementor="com.goldgrid.webservices.IQueryBusinessImpl" 
            address="/IQueryBusinessService">
            <jaxws:inInterceptors>
                <bean  class="com.goldgrid.webservices.AddSoapHeader"></bean> 
            </jaxws:inInterceptors>             
        </jaxws:endpoint>
    </beans>


    4.配置cxf servlet

         <servlet>
            <servlet-name>CXFServlet</servlet-name>
            <servlet-class>
                org.apache.cxf.transport.servlet.CXFServlet
            </servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>
    
        <servlet-mapping>
            <servlet-name>CXFServlet</servlet-name>
            <url-pattern>/services/*</url-pattern>
        </servlet-mapping>

    5.访问  http://localhost:port/webappname/services/...

     

  • 相关阅读:
    (转)机器学习——深度学习(Deep Learning)
    (转)Deep Learning深度学习相关入门文章汇摘
    (转)Haar-like矩形遍历检测窗口演示Matlab源代码
    HTML5远程工具
    splinter操作ie浏览器
    Wechat login authorization(OAuth2.0)
    Message Queuing(MSMQ)
    Visual Studio2017 数据库架构比较
    Visual Studio2017 Remote Debugger
    搭建Spring Initializr服务器
  • 原文地址:https://www.cnblogs.com/jerry19890622/p/3277832.html
Copyright © 2020-2023  润新知