I have been trying to send an DIME attachment of a file (100MB+). This same code works for a file around 40MB.
I am using Axis 1.3 and Weblogic 8.1.6. I am using commonshttpsender as described in axis FAQ.

Client Code:
        
        ((Stub)assetSourceClientAPIAdapter).addAttachment(new DataHandler(new FileDataSource(newFile)));
//        To use http 1.1 and chunking uncomment the line below and use CommonsHttp
        ((Stub)assetSourceClientAPIAdapter)._setProperty(MessageContext.HTTP_TRANSPORT_VERSION,  HTTPConstants.HEADER_PROTOCOL_V11);
        Hashtable myhttp = new Hashtable();           
        myhttp.put(HTTPConstants.HEADER_TRANSFER_ENCODING , HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED);
        ((Stub)assetSourceClientAPIAdapter)._setProperty(HTTPConstants.REQUEST_HEADERS, myhttp);
       
        ((Stub)assetSourceClientAPIAdapter)._setProperty( org.apache.axis.client.Call.ATTACHMENT_ENCAPSULATION_FORMAT,
                 org.apache.axis.client.Call.ATTACHMENT_ENCAPSULATION_FORMAT_DIME);
//call webservice with attachement.

I am assuming inorder to send large files, chunking is the way to go. Btw, is there a way to control the chunk size?

Server code:

MessageContext msgContext = MessageContext.getRequestMessage();
            Attachments messageAttachments = reqMsg.getAttachmentsImpl();
            int attachmentCount = messageAttachments.getAttachmentCount();
            if(attachmentCount != 1)  logger.warning("Unexpected number of attachments found :"+ attachmentCount);
            else { logger.finer("No of attachments = "+ attachmentCount);}
            Iterator it = messageAttachments.getAttachments().iterator();
            AttachmentPart part = (AttachmentPart) it.next();           
//          Get the streams to file and from attachment, then stream to disk
            InputStream instream;
            try {
                //Extract the first attachment. (Since in this case we have only one attachment sent)
                DataHandler dh = part.getDataHandler();              
                instream = dh.getInputStream();               
            } catch (SOAPException e) {                   
                e.printStackTrace();
                throw new LLException(e);
            } catch (IOException e) {                   
                e.printStackTrace();
                throw new LLException(e);
            }

Exceptions coming back from the server
Weblogic 8.1.6

faultDetail:
    {http://xml.apache.org/axis/}stackTrace:java.io.IOException: DIME header less than 12 bytes.
    at org.apache.axis.attachments.DimeDelimitedInputStream.readHeader (DimeDelimitedInputStream.java:319)
    at org.apache.axis.attachments.DimeDelimitedInputStream._read(DimeDelimitedInputStream.java:243)
    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:171)
    at org.apache.axis.attachments.AttachmentsImpl.getAttachmentCount (AttachmentsImpl.java:550)

Reply via email to