XFire的簡單配置

                  有段時間業務需要webservice,所以弄了下XFire,發現這個工具真的很傻瓜,接下來我就把如何配置詳細的說一下。
                  首先要引入相關的jar包,jar包我就不再這里列表了,童鞋們自己去下吧,呵呵,我用的版本是1.2.6,所以我只能保證在1.2.6下運行是正常的。
                  其次,請打開你的web.xml在里面添加一個servlet并將xfile的配置說明加入進去
              <context-param>
                  
          <param-name>contextConfigLocation</param-name>
                  
          <param-value>classpath*:config/spring/*.xml
                               classpath:org/codehaus/xfire/spring/xfire.xml
                  
          </param-value>
              
          </context-param>

                  
          1    <servlet>
          2        <servlet-name>xfire</servlet-name>
          3        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
          4    </servlet>
          5
          6    <servlet-mapping>
          7        <servlet-name>xfire</servlet-name>
          8        <url-pattern>/ws/*</url-pattern>
          9    </servlet-mapping>
                  請在WEB-INF下添加一個xfire-servlet.xml文件,具體內容如下
          <?xml version="1.0" encoding="UTF-8"?>
          <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
          <beans>

              
          <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
                  
          <property name="urlMap">
                      
          <map>
                          
          <entry key="/netsuiteservice">
                              
          <ref bean="netSuiteServiceCXF"/>
                          
          </entry>
                      
          </map>
                  
          </property>
              
          </bean>
              
              
          <bean id="netSuiteServiceCXF" class="org.codehaus.xfire.spring.remoting.XFireExporter">
                  
          <property name="serviceFactory">
                      
          <ref bean="xfire.serviceFactory"/>
                  
          </property>
                  
          <property name="xfire">
                      
          <ref bean="xfire"/>
                  
          </property>
                  
          <property name="serviceBean">
                      
          <ref bean="netSuiteService"/>
                  
          </property>
                  
          <property name="serviceClass">
                      
          <value>com.akazam.ws.INetSuiteService</value>
                  
          </property>
              
          </bean>

          </beans>
                  大家看看就明白了,這里就是定義service的地方,你要發布的service的配置說明
                 
           1<?xml version="1.0" encoding="UTF-8"?>
           2<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           3    xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:cxf="http://cxf.apache.org/core"
           4    xsi:schemaLocation="http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"
           5    default-lazy-init="true">
           6
           7    <description>Apache CXF的Web Service配置</description>
           8    <!-- WebService的實現Bean定義 -->
           9     <bean id="netSuiteService" class="com.akazam.ws.impl.NetSuiteServiceImpl"/>
          10</beans>

          接下來你只需要實現相關的接口就可以了


          posted on 2011-04-06 11:13 Cloud kensin 閱讀(427) 評論(0)  編輯  收藏 所屬分類: 其他

          <2011年4月>
          272829303112
          3456789
          10111213141516
          17181920212223
          24252627282930
          1234567

          導航

          統計

          常用鏈接

          留言簿(4)

          隨筆分類

          相冊

          相冊

          搜索

          最新評論

          主站蜘蛛池模板: 惠州市| 昌图县| 麻栗坡县| 保德县| 松江区| 东光县| 卢龙县| 瑞昌市| 牟定县| 杂多县| 云霄县| 祁门县| 郓城县| 夹江县| 山西省| 临澧县| 万盛区| 大荔县| 泾川县| 甘泉县| 盐源县| 乳山市| 庆云县| 宁城县| 于都县| 尚义县| 霸州市| 钦州市| 项城市| 云和县| 志丹县| 莱芜市| 平安县| 武夷山市| 临泽县| 洪湖市| 石屏县| 黄骅市| 凤台县| 山东省| 英德市|