Posted on 2008-07-18 19:11
Coolfiry 閱讀(2568)
評(píng)論(0) 編輯 收藏 所屬分類:
Java
在項(xiàng)目開(kāi)發(fā)過(guò)程中,遇到在本機(jī)和windows環(huán)境中部署用CXF框架開(kāi)發(fā)的的webService沒(méi)有任何問(wèn)題,但是當(dāng)將工程部署到solaris 的SUN ONE application上時(shí),再用本機(jī)的cxf Web服務(wù)客戶端訪問(wèn)對(duì)應(yīng)的web服務(wù)時(shí),如果傳輸?shù)臄?shù)據(jù)量小于大約4K不會(huì)出問(wèn)題,否則則會(huì)報(bào)一些數(shù)據(jù)綁定的異常如:
Marshalling Error: Error writing request body to server。
解決這個(gè)問(wèn)題花了我足足兩天時(shí)間,原因是有關(guān)CXF的資料太少了,而且有關(guān)于這個(gè)錯(cuò)誤的解決都必須使用google才能search到,用baidu完全search不到相關(guān)的資料。
解決方案:
在客戶端的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>
這個(gè)問(wèn)題的解決方案是我在cxf的官網(wǎng)上找了很久才找到的,雖然問(wèn)題解決了,但是我感到很迷惑。主要在windows tomcat環(huán)境下沒(méi)有問(wèn)題,而到了SUN ONE的環(huán)境就有問(wèn)題,經(jīng)過(guò)的思考和找了一資料,我認(rèn)為問(wèn)題出于solaris對(duì)于HTTP數(shù)據(jù)傳輸?shù)哪承┫拗疲绻嬉ジ闱宄脑捒赡芤⒖碿xf的source code了,但是我不想花這個(gè)時(shí)間去研究這個(gè)問(wèn)題了。
我把這個(gè)解決方案寫出來(lái),希望可以幫助到使用CXF的網(wǎng)友,也希望高手們能幫我解決我的迷惑。