coolfiry

          認認真真做人,兢兢業業做事!
          posts - 39, comments - 17, trackbacks - 0, articles - 0

          在使用CXF WebService框架時遇到的問題與解決方案

          Posted on 2008-07-18 19:11 Coolfiry 閱讀(2572) 評論(0)  編輯  收藏 所屬分類: Java
          在項目開發過程中,遇到在本機和windows環境中部署用CXF框架開發的的webService沒有任何問題,但是當將工程部署到solaris 的SUN ONE application上時,再用本機的cxf Web服務客戶端訪問對應的web服務時,如果傳輸的數據量小于大約4K不會出問題,否則則會報一些數據綁定的異常如:
          Marshalling Error: Error writing request body to server。
          解決這個問題花了我足足兩天時間,原因是有關CXF的資料太少了,而且有關于這個錯誤的解決都必須使用google才能search到,用baidu完全search不到相關的資料。
          解決方案:
          在客戶端的class-path中加上cxf.xml。cxf.xml的配置如下:
          <?xml version="1.0" encoding="UTF-8"?>
          <beans xmlns="http://www.springframework.org/schema/beans"
              xmlns:xsi
          ="http://www.w3.org/2001/XMLSchema-instance"
              xmlns:http
          ="http://cxf.apache.org/transports/http/configuration"
              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
           http://cxf.apache.org/transports/http/configuration
          http://cxf.apache.org/schemas/configuration/http-conf.xsd"
          >
              
          <http:conduit name="*.http-conduit">
                  
          <http:client AutoRedirect="true" />
              
          </http:conduit>
          </beans>
          這個問題的解決方案是我在cxf的官網上找了很久才找到的,雖然問題解決了,但是我感到很迷惑。主要在windows tomcat環境下沒有問題,而到了SUN ONE的環境就有問題,經過的思考和找了一資料,我認為問題出于solaris對于HTTP數據傳輸的某些限制,如果真要去搞清楚的話可能要去參看cxf的source code了,但是我不想花這個時間去研究這個問題了。

          我把這個解決方案寫出來,希望可以幫助到使用CXF的網友,也希望高手們能幫我解決我的迷惑。



          主站蜘蛛池模板: 上饶市| 嵩明县| 大姚县| 荔浦县| 应城市| 宁南县| 湄潭县| 融水| 密云县| 兴城市| 鱼台县| 阜南县| 根河市| 聂荣县| 马鞍山市| 康马县| 虞城县| 大荔县| 五台县| 招远市| 南郑县| 卓资县| 武陟县| 凤山市| 根河市| 三明市| 黑山县| 灌云县| 浠水县| 红安县| 沈丘县| 雷州市| 平昌县| 石泉县| 崇州市| 永顺县| 浦城县| 克山县| 舟曲县| 会泽县| 大余县|