Domino Web服务提供商限制

时间:2017-06-29 02:17:57

标签: web service stream lotus-domino

我正在实现一个多米诺网络服务提供商,其目的是从base64格式流式传输,该格式在使用Web服务的客户端中是附件文件,然后将其转换回文件。在使用java开发的Web服务提供程序中,我使用Stream类和Mime类来转换流和文件。 Web服务提供程序适用于最大5 MB的文件,对于较大的文件,显示错误technote。有人有过这个问题吗?有什么方法吗?

以下是网络服务提供商的代码

public class criaAnexo {
private Vector itemsToRecycle;
public void attachDocument( byte[] is) {

    // creating the output stream used to create the MIME attachments
    try
    {

        itemsToRecycle = new Vector(); 
        Session session = NotesFactory.createSession();
        Database db = session.getDatabase("Serverx", "base.nsf");
        if (!db.isOpen())
            System.out.println("names2.nsf does not exist on snapper");
        else
        {
            Stream outStream = session.createStream();
            outStream.write(is);


            session.setConvertMIME(false);

            // create the MIME body
            Document doc = db.createDocument();
            doc.replaceItemValue("Form", "formAttachment");
            MIMEEntity body = doc.createMIMEEntity();


            // create a child for each attachment<br/>
            MIMEEntity child = body.createChildEntity();

            // find the fileSuffix<br/>
            //String fileSuffix = files[i].substring(files[i].lastIndexOf(".")+1);
            String fileSuffix = "pdf";


            // set the child to the outstream using a mapped MIME type<br/>
            // MIME type mapping see: http://www.w3schools.com/media/media_mimeref.asp

            //child.setContentFromBytes(outStream, mapMIMEType(fileSuffix), MIMEEntity.ENC_IDENTITY_BINARY);

            child.setContentFromBytes(outStream, "application/pdf", MIMEEntity.ENC_IDENTITY_BINARY);


            // set name for file attachment<br/>
            MIMEHeader header = child.createHeader("Content-Disposition");
            header.setHeaderVal("attachment; filename=\"teste.pdf\"");

            // set unique id for file attachment to be able to refer to it<br/>
            header = child.createHeader("Content-ID");
            header.setHeaderVal("teste.pdf");

            //outStream.truncate();
            //outStream.close();
            outStream.close();
            Runtime rt = Runtime.getRuntime(); 
            long total_mem = rt.totalMemory(); 
            long free_mem = rt.freeMemory(); 
            long used_mem = total_mem - free_mem; 
            System.out.println("Total de Memória:"+total_mem); 
            System.out.println("Total de Memória livre:"+free_mem);
            System.out.println("Total de memoria usada pelo agente: " + used_mem/1048576);  


            doc.save( true, true );
            itemsToRecycle.add(doc);
            session.recycle(itemsToRecycle); //recycle all items added to vector 
            session.recycle();

        }



    }
    catch(Exception e)
    {
    }
}

}

2 个答案:

答案 0 :(得分:0)

由于base64编码和其他开销,大于5 MB的文件可能超过您为请求内容的最大大小最大POST数据服务器的设置。尝试增加它们。

答案 1 :(得分:0)

实际上,限制发生在使用我在多米诺骨牌本身中实现的Web服务的客户端中。在问题描述中引用的技术说明暗示问题出在提供者一边,但事实上并非如此。当我在dot net上实现Web服务客户端时,文件流没有问题。