I am using Axis 1.2.1 and trying to pass files, using the axis attachment support,
I works fine for small files, but when I try to pass 3MB file, I am getting and exception from Axis on the server side,
Please note that, when I use Axis 1.1 there is no problem sending large files(I tested upto 50 MB).
This exception happens only in Axis 1.2.1 and also Axis 1.3.
I cannot go back to Axis 1.1 because we have upgraded to jdk1.5,
Any help to solve this problem is very much appreciated ,
Thanks,
-Mukesh Kumar
Stack trace Snippet:(Please see full stack trace, client and server side code attached)
===============
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.io.IOException: End of physical stream detected when 133 more bytes expected.
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:java.io.IOException: End of physical stream detected when 133 more bytes expected.
at org.apache.axis.attachments.DimeDelimitedInputStream._read(DimeDelimitedInputStream.java:273)
at org.apache.axis.attachments.DimeDelimitedInputStream.read(DimeDelimitedInputStream.java:201)
at org.apache.axis.attachments.DimeDelimitedInputStream.read(DimeDelimitedInputStream.java:445)
at org.apache.axis.attachments.ManagedMemoryDataSource.<init>(ManagedMemoryDataSource.java:146)
at org.apache.axis.attachments.MultiPartDimeInputStream.readTillFound(MultiPartDimeInputStream.java:163)
at org.apache.axis.attachments.MultiPartDimeInputStream.readAll(MultiPartDimeInputStream.java:100)
at org.apache.axis.attachments.MultiPartDimeInputStream.getAttachments(MultiPartDimeInputStream.java:108)
at org.apache.axis.attachments.AttachmentsImpl.mergeinAttachments(AttachmentsImpl.java:156)
at org.apache.axis.attachments.AttachmentsImpl.getAttachmentCount(AttachmentsImpl.java:515)
at com.cisco.aons.ama.provision.ExtensionPackageManager.downloadExtensionPackage(ExtensionPackageManager.java:8
Server side Code to download the attched file:
===========================================
public static void downloadExtensionPackage() throws Exception
{
Attachments atchmts = CurrentAttachment.getAttachment();
MessageContext messageContext=MessageContext.getCurrentContext();
if (messageContext != null) {
Message message = messageContext.getRequestMessage();
Attachments messageAttachments = message.getAttachmentsImpl();
if(messageAttachments != null && messageAttachments.getAttachmentCount()
> 0 ){
atchmts = messageAttachments;
}
}
if (atchmts == null || atchmts.getAttachmentCount() == 0 ) return;
try{
File dest = new File(extPackagePath);
if (dest.exists()) {
assert(dest.isDirectory());
} else {
dest.mkdirs();
}
//int attachmentcount=atchmts.getAttachmentCount();
//log.info("YES attachments support, attachment count :
"+attachmentcount);
String extPackageName = "ext-bundle" + aonsBundle.getId() + ".zip";
Iterator iterator=atchmts.getAttachments().iterator();
while(iterator.hasNext()){
AttachmentPart part=(AttachmentPart)iterator.next();
DataHandler dataHandler = part.getDataHandler();
log.info("Attachment file name :"+dataHandler.getName());
dataHandler.writeTo(new java.io.FileOutputStream( extPackagePath+
File.separator +extPackageName));
part.dispose();
}
log.info("YES successfully executed attachment download");
CurrentAttachment.clear();
}
catch (AxisFault axisFaultException){
log.error("AxisFaultException thrown :" +
axisFaultException.dumpToString());
}
catch (Exception exception){
log.error("Exception thrown : ", exception);
}
//new code added by mukesh ends here
//}
}
Client side Code to attach the file:
========================================
Service service = new Service();
Call call = (Call) service.createCall();
......
if (aonsBundle != null &&
aonsBundle.getExtensionsZipArchiveFullPath() != null) {
call.setProperty(Call.ATTACHMENT_ENCAPSULATION_FORMAT,
Call.ATTACHMENT_ENCAPSULATION_FORMAT_DIME);
AttachmentPart attachmentPart = new AttachmentPart(new
DataHandler(new
FileDataSource(aonsBundle.
getExtensionsZipArchiveFullPath())));
call.addAttachmentPart(attachmentPart);
}
call.addParameter("context", tCtxQname, ParameterMode.IN);
call.addParameter("amaBundle", amaBundleQName, ParameterMode.IN);
call.addParameter("aonsBundle", aonsBundleQName, ParameterMode.IN);
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_BOOLEAN);
setTimoutPeriod(call, aonsBundle);
log.trace("Time-out period set is: " + call.getTimeout());
Boolean retval = (Boolean) call.invoke(new Object[] {tCtx,
amaBundle, aonsBundle});
CompleteStack Trace of the Axis excption thrown on the server side.text
Description: Binary data
