JAVA End of stream encountered before final boundary mark问题

1. 此问题发生在我需要使用webservice 的handler 发送公文。遇到如下报错:

023-07-14 08:42:53,377 INFO  A2  - [null] resin-port-8002-29-29[weaver.dtjt.wx.action.UpSendAction:159] - 路径=C:\weaver_develop\lumen公文正文.dat
2023-07-14 08:42:53,377 INFO  A2  - [null] resin-port-8002-29-29[weaver.dtjt.wx.action.UpSendAction:187] - 路径=C:\weaver_develop\lumen公文附件.zip
2023-07-14 08:42:53,377 INFO  A2  - [null] resin-port-8002-29-29[weaver.dtjt.wx.action.UpSendAction:189] - docxml=<?xml version='1.0' encoding='UTF-8'?><COMP><document><FLDTM>测试-lumen</FLDTM><FLDFWJG></FLDFWJG><FLDFWRQ>2023-06-15</FLDFWRQ><FLDFWH>lumen 17号</FLDFWH><FLDZSJG></FLDZSJG><FLDCSJG></FLDCSJG><FLDSWJG></FLDSWJG><FLDSWBM></FLDSWBM><FLDSWLX></FLDSWLX><FLDMJ>普通</FLDMJ><FLDJJCD>普通</FLDJJCD><FLDWZ></FLDWZ><FLDSFGX></FLDSFGX><FLDZTC></FLDZTC><FLDBZ></FLDBZ><FSDW>jjyjy</FSDW><FLDWJZT>0</FLDWJZT><FLDFSSJ></FLDFSSJ><DOCID></DOCID><FLDYQBJSJ></FLDYQBJSJ><FBBM></FBBM><FBR></FBR><LXDH></LXDH><CZ></CZ><FS></FS><SJYJXX></SJYJXX><OAWFSJ></OAWFSJ></document></COMP>
2023-07-14 08:42:53,377 INFO  A2  - [null] resin-port-8002-29-29[weaver.dtjt.wx.action.UpSendAction:190] - attmentxml=<?xml version='1.0' encoding='UTF-8'?><COMP><attachment><FLDFJBT>lumen-测试正文</FLDFJBT><FLDFJWH></FLDFJWH><FLDFJFWJG></FLDFJFWJG><FLDFJLX>加密文件正文</FLDFJLX><FLDWJM>lumen公文正文.dat</FLDWJM><FLDFJURL></FLDFJURL></attachment><attachment><FLDFJBT>lumen附件</FLDFJBT><FLDFJWH></FLDFJWH><FLDFJFWJG></FLDFJFWJG><FLDFJLX>normal</FLDFJLX><FLDWJM>lumen公文附件.zip</FLDWJM><FLDFJURL></FLDFJURL></attachment></COMP>
2023-07-14 08:42:53,377 INFO  A2  - [null] resin-port-8002-29-29[weaver.dtjt.wx.action.UpSendAction:191] - dhandlerList个数=2
2023-07-14 08:42:54,572 INFO  A2  - [null] resin-port-8002-29-29[weaver.dtjt.wx.action.UpSendAction:458] - java.lang.RuntimeException: java.io.IOException: End of stream encountered before final boundary marker.AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode: 
 faultString: java.io.IOException: End of stream encountered before final boundary marker.
 faultActor: 
 faultNode: 
 faultDetail: 
    {http://xml.apache.org/axis/}stackTrace:java.io.IOException: End of stream encountered before final boundary marker.
    at org.apache.axis.attachments.BoundaryDelimitedStream.read(BoundaryDelimitedStream.java:308)
    at org.apache.axis.attachments.BoundaryDelimitedStream.read(BoundaryDelimitedStream.java:358)
    at org.apache.axis.attachments.ManagedMemoryDataSource.&lt;init&gt;(ManagedMemoryDataSource.java:146)
    at org.apache.axis.attachments.MultiPartRelatedInputStream.readTillFound(MultiPartRelatedInputStream.java:557)
    at org.apache.axis.attachments.MultiPartRelatedInputStream.readAll(MultiPartRelatedInputStream.java:433)
    at org.apache.axis.attachments.MultiPartRelatedInputStream.getAttachments(MultiPartRelatedInputStream.java:439)
    at org.apache.axis.attachments.AttachmentsImpl.mergeinAttachments(AttachmentsImpl.java:173)
    at org.apache.axis.attachments.AttachmentsImpl.getAttachmentByReference(AttachmentsImpl.java:343)
    at org.apache.axis.encoding.DeserializationContext.getObjectByRef(DeserializationContext.java:617)
    at org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:351)
    at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1048)
    at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
    at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
    at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
    at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)

 此问题是由于 axis.jar包太老 是1.4的。意思是Axis1.4 用的是HTTP1.0来传递数据,不支持分块传输编码 可能在接收到所有的块之前关闭掉这个链接。当反序列话返回的SOAP消息的时候,会抛出XMML格式非法或者某些标签未关闭的异常,原因是没有接收到完整的SOAP响应消息。

所以需要修改修改axis.jar包文件里的org/apache/axis/client/client-config.wsdd文件。替换成下面的代码:

<?xml version="1.0" encoding="UTF-8"?>
<deployment name="ApacheCommonsHTTPConfig" xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
 
 <globalConfiguration>
 
  <parameter name="disablePrettyXML" value="true"/>
 
  <parameter name="enableNamespacePrefixOptimization" value="false"/>
 
 </globalConfiguration>
 
 <transport name="http" pivot="java:org.apache.axis.transport.http.CommonsHTTPSender" />
 
 <transport name="local" pivot="java:org.apache.axis.transport.local.LocalSender" />
 
 <transport name="java" pivot="java:org.apache.axis.transport.java.JavaSender" />
 
</deployment>

这样客户端就能通过http1.1来传递参数了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值