沙漠中的魚

          欲上天堂,先下地獄
          posts - 0, comments - 56, trackbacks - 0, articles - 119
            BlogJava :: 首頁 ::  :: 聯系 :: 聚合  :: 管理

          CXF服務集成Spring的配置(訪問路徑)

          Posted on 2012-05-08 15:57 沙漠中的魚 閱讀(2914) 評論(0)  編輯  收藏 所屬分類: 開源框架Java
          在Web.xml添加CXFServlet的配置
          <servlet>
                  <servlet-name>CXFServlet</servlet-name>
                  <servlet-class>
                      org.apache.cxf.transport.servlet.CXFServlet
                  </servlet-class>
                  <load-on-startup>0</load-on-startup>
              </servlet>

              <servlet-mapping>
                  <servlet-name>CXFServlet</servlet-name>
                  <url-pattern>/services/*</url-pattern>
              </servlet-mapping>
          其中/services/*表示會攔截所有services下的訪問路徑。
          <beans xmlns="http://www.springframework.org/schema/beans"
              xmlns:xsi
          ="http://www.w3.org/2001/XMLSchema-instance"
              xmlns:jaxws
          ="http://cxf.apache.org/jaxws"
              xmlns:context
          ="http://www.springframework.org/schema/context"
              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
              http://www.springframework.org/schema/context   
              http://www.springframework.org/schema/context/spring-context-3.0.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" />

              <context:annotation-config/>
              <context:component-scan base-package="com.*.server.resource"></context:component-scan>

              <!-- 登陸服務 -->
              <jaxws:endpoint 
                
          id="LoginService" 
                implementor
          ="com.*.ws.LoginService" 
                address
          ="/ILoginService" >
               </jaxws:endpoint>
          </beans>
          則當前CXF的訪問路徑為 http://url/projectname/services/ILoginService。
          而不是:http://url/projectname/ILoginService(注意添加services的路徑)
          主站蜘蛛池模板: 田东县| 萨嘎县| 延庆县| 乌兰浩特市| 大余县| 延安市| 武穴市| 合水县| 松溪县| 河源市| 双桥区| 堆龙德庆县| 昌吉市| 芷江| 冕宁县| 盐源县| 博罗县| 遂昌县| 承德市| 民和| 大邑县| 尚志市| 普兰县| 修水县| 陈巴尔虎旗| 集安市| 宜州市| 岢岚县| 夏邑县| 格尔木市| 衡阳市| 新源县| 吕梁市| 淮安市| 南部县| 贡嘎县| 梁河县| 墨竹工卡县| 关岭| 姜堰市| 桦南县|