coolfiry

认认真真做人,兢兢业业做事!
posts - 39, comments - 17, trackbacks - 0, articles - 0

在使用CXF WebService框架时遇到的问题与解决方案

Posted on 2008-07-18 19:11 Coolfiry 阅读(2503) 评论(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的网友,也希望高手们能帮我解决我的迷惑。




只有注册用户登录后才能发表评论。


网站导航: