You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Mahendra Chheda <mc...@zantaz.com> on 2001/08/17 01:13:53 UTC

Saving files on server using SOAP MIME example

Hello,

I modified the samples/mime/MimeTest.java code to make the server write out
files to the server file system. I did not get an errors with this code,
however i dont see any files either. Can someone guide me on what am i doing
wrong. Thanx.

Mahendra Chheda
Zantaz


//Code snippet from MimeTest.java

    public static String sendFile(DataHandler dh) throws IOException
    {
        FileOutputStream filename = new FileOutputStream("/tmp/soap.file") ;
        int c ;

        InputStream fin = dh.getInputStream() ;
        while((c = fin.read()) != -1)
            filename.write((char) c) ;
        filename.close() ;
        fin.close() ;

        StringBuffer sb = new StringBuffer("Received attachment:\n");
        sb.append("Content type: ").append(dh.getContentType());
	  : 
	  : code from samples/mime/MimeTest.java