Title: SOAP attachement (pdf) stored into a db field

I have a SOAP service that I would like to receive and store both XML based messages and their corresponding MIME attachments, in particular large, 20+ MB file sizes directly into a database "image" type field in MS-SQL.  I can easily direct the attachement to a file:

private void persistToFile(AttachmentPart ap,int partNum, String persistToDirectory) {
                java.io.InputStream content = null;
                FileOutputStream fileOutputStream = null;
                File attachFile = null;
                byte[] buffer = new byte[10000];
                int len ;
               
                try {  
                        attachFile = new File(persistToDirectory + "\\NIHReply_" + partNum + "_" + (new Date().getTime()) + ".pdf");

                        fileOutputStream = new FileOutputStream(attachFile);
                        content = (java.io.InputStream)ap.getContent();
                        streamCopy(content, fileOutputStream);
                        partNum++;
                        fileOutputStream.close();
                } catch(Exception ex) {
                        ex.printStackTrace();  
                }
        }

Where ap is an AttachmentPart object of type javax.xml.soap.AttachmentPart.

But, it is unclear how to proceed with this large stream in iBattis, which I am using just fine in the rest of my webservice.

Thanks,

Scott

_____________________________
Scott Horgen
Java Architect

InfoEd International, Inc.
1873 Western Avenue, Suite 201
Albany, NY 12203
Tel:   518-464-0691
        800-727-6427
Fax: 518-464-0695


Reply via email to