我正在尝试使用ksoap2作为客户端发送一个zip文件...文件到达但已损坏,我认为当我在Base64中编码它时,我的代码中有些东西(我使用的是公共代码)... < / p>
WS
FileInputStream fis = new FileInputStream(path.toString()+zipName.toString());
byte[] toByteArray = IOUtils.toByteArray(fis);
byte[] encodeBase64 = Base64.encodeBase64(toByteArray);
return encodeBase64;
客户端
SoapPrimitive soapPrimitive = (SoapPrimitive) soapSerializationEnvelope.getResponse();
String result = soapPrimitive.toString();
byte[] decode = Base64.decode(result);
String formPath = "C:\\Users\\John\\Desktop\\test.zip";
boolean flag = new File(path.toString()).mkdirs();
FileOutputStream fileOutputStream = new FileOutputStream(formPath);
fileOutputStream.write(decode);
fileOutputStream.flush();
fileOutputStream.close();
服务器中的文件没问题,我可以打开它但是当它到达客户端时它已经损坏了
感谢...