<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    少年阿賓

    那些青春的歲月

      BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
      500 Posts :: 0 Stories :: 135 Comments :: 0 Trackbacks

    /**
     *
     */
    package com.abin.lee.cxf;

    import javax.jws.WebService;

    /**
     * @author abin
     *
     */
    @WebService(targetNamespace="cxf.lee.abin.com")
    public interface IUserService {
     public String getMessage(String message);
    }





    package com.abin.lee.cxf;

    import javax.jws.WebService;

    @WebService(endpointInterface="com.abin.lee.cxf.IUserService")
    public class UserService implements IUserService{

     public String getMessage(String message) {
      return message+" welcome to beijing";
     }
     
    }






    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns=" xmlns:xsi=" xmlns:tx=" xmlns:jaxws=" xmlns:cxf=" xmlns:wsa=" xsi:schemaLocation="http://www.springframework.org/schema/beans
     http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
     http://www.springframework.org/schema/tx
     http://www.springframework.org/schema/tx/spring-beans-3.0.xsd
     http://cxf.apache.org/core
     http://cxf.apache.org/schemas/core.xsd
     http://cxf.apache.org/jaxws
     http://cxf.apache.org/schemas/jaxws.xsd
     http://www.springframework.org/schema/aop
     http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
     http://www.springframework.org/schema/context
      <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" />
     
     <cxf:bus>
      <cxf:features>
       <!--日志攔截功能,用于監控soap內容,開發后可以刪除 -->
       <cxf:logging/>
       <wsa:addressing/>
      </cxf:features>
     </cxf:bus> 

     <bean id="userService" class="com.abin.lee.cxf.UserService"></bean>
     <jaxws:endpoint id="userWebservice" implementor="#userService" address="/UserService" publish="true" />


    </beans>

     





    <context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>
       <!--
         classpath*:com/abin/lee/spring/queue/applicationContext-springqueue.xml,
         classpath*:com/abin/lee/quartz/applicationContext-quartzCluster.xml,
         classpath*:com/abin/lee/quartz/applicationContext-quartzHeartCluster.xml,
         classpath*:com/abin/lee/quartz/applicationContext-activemq.xml
       -->
       classpath*:com/abin/lee/cxf/applicationContext-cxf.xml
      </param-value>
     </context-param>
     <listener>
      <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
     </listener>
     <!--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>/service/*</url-pattern>   
     </servlet-mapping> 






    package com.abin.lee.spring;

    import org.springframework.beans.BeansException;
    import org.springframework.context.ApplicationContext;
    import org.springframework.context.ApplicationContextAware;
    import org.springframework.context.support.ClassPathXmlApplicationContext;

    /**
     *
     * 獲取spring容器,以訪問容器中定義的其他bean
     *
     * @author lyltiger
     * @since MOSTsView 3.0 2009-11-16
     */
    public class SpringContextUtil implements ApplicationContextAware {

     // Spring應用上下文環境
     private static ApplicationContext applicationContext = new ClassPathXmlApplicationContext(
       "com/abin/lee/cxf/applicationContext-cxf.xml");

     /**
      * 實現ApplicationContextAware接口的回調方法,設置上下文環境
      *
      * @param applicationContext
      */
     public void setApplicationContext(ApplicationContext applicationContext) {
      SpringContextUtil.applicationContext = applicationContext;
     }

     /**
      * @return ApplicationContext
      */
     public static ApplicationContext getApplicationContext() {
      return applicationContext;
     }

     /**
      * 獲取對象 這里重寫了bean方法,起主要作用
      *
      * @param name
      * @return Object 一個以所給名字注冊的bean的實例
      * @throws BeansException
      */
     public static Object getBean(String name) throws BeansException {
      return applicationContext.getBean(name);
     }

    }









    package com.abin.lee.cxf.test;

    import com.abin.lee.cxf.UserService;
    import com.abin.lee.spring.SpringContextUtil;

    import junit.framework.TestCase;

    public class TestUserService extends TestCase{
     public void testcxf(){
      UserService userService=(UserService)SpringContextUtil.getBean("userService");
      
      String response=userService.getMessage("abin");
      System.out.println("response="+response);
      System.exit(0);
     }
    }


    主站蜘蛛池模板: 亚洲AV无码国产在丝袜线观看| 亚洲大成色www永久网址| 1000部国产成人免费视频| 亚洲国产成a人v在线观看| 又大又硬又爽免费视频| 大地资源网高清在线观看免费| 亚洲第一成年网站大全亚洲| 天天操夜夜操免费视频| 99久久免费国产精品热| 色噜噜亚洲男人的天堂| 亚洲精品偷拍视频免费观看 | 二级毛片免费观看全程| 亚洲一卡2卡三卡4卡有限公司| 精品国产免费一区二区| 国产午夜成人免费看片无遮挡 | 久草福利资源网站免费| 大桥未久亚洲无av码在线| 亚洲精品免费在线观看| 亚洲A∨精品一区二区三区| 国产在线观看麻豆91精品免费| 人成午夜免费大片在线观看| 亚洲国产精品无码久久久| 日韩一卡2卡3卡4卡新区亚洲| 青青在线久青草免费观看| 中文字幕在线观看免费| 亚洲国产无线乱码在线观看| 91亚洲国产成人久久精品网站| 久久久久亚洲AV无码专区网站 | 亚洲天天在线日亚洲洲精| 免费人成视网站在线观看不卡| 免费观看美女用震蛋喷水的视频| 久久国产一片免费观看| 亚洲Av永久无码精品一区二区| 亚洲精品视频久久| 亚洲另类激情综合偷自拍图| 四虎永久精品免费观看| 成人免费无码视频在线网站| 91青青青国产在观免费影视| 嫩草在线视频www免费看| 一级毛片视频免费| 美女免费视频一区二区|