File files[] = new File[3];
files[0]=file;
files[1]=file1;
files[2]=file2;
byte[] fbyte = null;
byte[] fileEncrypt = null;
DataSource fileDs = null;
DataHandler fileDh = null;
AttachmentPart fileAtt = null;
List<AttachmentPart> attachments = new ArrayList<AttachmentPart>();
int i=1;
for(File f : files){
if(f==null)continue;
fbyte = ByteFileUtil.getBytesFromFile(f);
fileEncrypt = AESJava.Encrypt(fbyte);
fileDs = new ByteArrayDataSource(fileEncrypt, "text/xml");
fileDh = new DataHandler(fileDs);
fileAtt = new AttachmentPart(fileDh);
fileAtt.setContentId(i+".docx");
attachments.add(fileAtt);
i++;
}
if (attachments != null && !attachments.isEmpty()) {
call.setProperty(call.ATTACHMENT_ENCAPSULATION_FORMAT,call.ATTACHMENT_ENCAPSULATION_FORMAT_DIME); // 是用DIME附件和.net服务端对应
for (Iterator iterator = attachments.iterator(); iterator.hasNext();) {
AttachmentPart attachment = (AttachmentPart) iterator.next();
call.addAttachmentPart(attachment);
}
}
call.addParameter("fileName", XMLType.XSD_STRING, ParameterMode.IN);
Object[] param = new Object[1];
param[0]="sss.docx";
call.setOperationName(method);
call.setUseSOAPAction(true);
call.setReturnType(org.apache.axis.Constants.XSD_STRING);
call.setSOAPActionURI(nameSpace+method);
call.setUseSOAPAction(true);
obj = call.invoke(param);
调时,如果单个文件大于1MB就报下面错,多个文件如果都小于1MB的没有任何问题 。
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.net.SocketException: Connection reset
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at java.io.FilterInputStream.read(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager$RewindableInputStream.read(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at fe.docexchange.utils.encrypt.RSAJava.send(RSAJava.java:345)
at fe.docexchange.utils.encrypt.RSAJava.main(RSAJava.java:195)
{http://xml.apache.org/axis/}hostname:S56C-PC
java.net.SocketException: Connection reset
at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:701)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at fe.docexchange.utils.encrypt.RSAJava.send(RSAJava.java:345)
at fe.docexchange.utils.encrypt.RSAJava.main(RSAJava.java:195)
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at java.io.FilterInputStream.read(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager$RewindableInputStream.read(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
... 10 more
Hi,do you resolved your the issue? I meet the same one