java - Nullpointer exception soapui file upload call -
i have upload file using soap ui.below service code.it executes fine if call using jersey.but when try call using soapui null pointer exception occurs.
i call fileupload service in soap ui below
create rest project: add url:
http://localhost:8080/fileservice/services/homeservice/testupload file file:c:\\1.wav @post @path("testupload") @consumes(mediatype.multipart_form_data) @produces(mediatype.text_plain) public string uploadfile(@formdataparam("file") inputstream fis, @formdataparam("file") formdatacontentdisposition fdcd) { outputstream outpustream = null; string filename = fdcd.getfilename(); string filepath = folder_path + filename; try { int read = 0; byte[] bytes = new byte[1024]; outpustream = new fileoutputstream(new file(filepath)); while ((read = fis.read(bytes)) != -1) { outpustream.write(bytes, 0, read); } outpustream.flush(); outpustream.close(); } catch(ioexception iox){ iox.printstacktrace(); } { if(outpustream != null){ try{outpustream.close();} catch(exception ex){} } } return "file upload !!"; }
how fix issue? appreciated!!!
Comments
Post a Comment