日期:2014-05-20  浏览次数:20542 次

Axis Web Services 返回的XML中文结果不完整
Apache + Tomcat + Axis
返回的结果XML中,不管文本长短,后面一些中文字符总是被截断,但如果全部为英文则正常。是否设置有问题?

------解决方案--------------------
是不是你的中文中带有换行符而英文中没有换行符啊?
------解决方案--------------------
猜测是编码问题引起的。
service.xml文件里的编码改改看可以么
------解决方案--------------------
怀疑是你的编码不一致导致的,先保证xml server端和client端的中文编码都一致,再测试看一看。


------解决方案--------------------
建议先读成byte,然后看看字节大小,然后再做讨论。
有的时候可能会由于中文的文字和ASCII码的某些东西冲突,反馈的东西被截断
------解决方案--------------------
应该是你的编码问题 你写个过滤器 试试看
------解决方案--------------------
手动写个文件编码过滤器。

service.xml是建web service工程时,它在WebServices文件夹下面
我的service.xml:
XML code
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xfire.codehaus.org/config/1.0">

    <service>
        <name>infoService</name>
        <serviceClass>com.hgeagle.rescue.ws.IinfoService</serviceClass>
        <implementationClass>
            com.hgeagle.rescue.ws.infoServiceImpl
        </implementationClass>
        <style>wrapped</style>
        <use>literal</use>
        <scope>application</scope>
    </service>
    <service>
        <name>addressMappingService</name>
        <serviceClass>
            com.hgeagle.rescue.wsmap.IaddressMappingService
        </serviceClass>
        <implementationClass>
            com.hgeagle.rescue.wsmap.addressMappingServiceImpl
        </implementationClass>
        <style>wrapped</style>
        <use>literal</use>
        <scope>application</scope>
        <!--  -->
        <inHandlers>
            <handler handlerClass="com.hgeagle.rescue.ws.facade.AuthenticationHandler"></handler>
        </inHandlers>
    </service>
    <service>
        <name>telcomService</name>
        <serviceClass>com.telcom.ws.ItelcomService</serviceClass>
        <implementationClass>
            com.telcom.ws.telcomServiceImpl
        </implementationClass>
        <style>wrapped</style>
        <use>literal</use>
        <scope>application</scope>
    </service>
    
</beans>

------解决方案--------------------
编码不一致吧


过滤器很不错