在我的应用程序中,我调用wcf webservice方法通过base 64发送图像...在调用该方法后,我收到错误:
03-17 12:02:13.187: W/System.err(5822): java.lang.IllegalArgumentException: size <= 0
03-17 12:02:13.195: W/System.err(5822): at java.io.BufferedInputStream.<init>(BufferedInputStream.java:94)
03-17 12:02:13.195: W/System.err(5822): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:226)
03-17 12:02:13.195: W/System.err(5822): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:114)
03-17 12:02:13.195: W/System.err(5822): at com.android.lntproject.SOAPWebservice.Base64ToImage(SOAPWebservice.java:982)
03-17 12:02:13.195: W/System.err(5822): at com.android.mobescan.ImageUtils.getCompressedImagePath(ImageUtils.java:119)
03-17 12:02:13.195: W/System.err(5822): at com.android.mobescan.HomeActivity$UploadScan.doInBackground(HomeActivity.java:537)
03-17 12:02:13.195: W/System.err(5822): at com.android.mobescan.HomeActivity$UploadScan.doInBackground(HomeActivity.java:1)
03-17 12:02:13.195: W/System.err(5822): at android.os.AsyncTask$2.call(AsyncTask.java:287)
03-17 12:02:13.195: W/System.err(5822): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
03-17 12:02:13.203: W/System.err(5822): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
03-17 12:02:13.203: W/System.err(5822): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
03-17 12:02:13.203: W/System.err(5822): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
03-17 12:02:13.203: W/System.err(5822): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
03-17 12:02:13.210: W/System.err(5822): at java.lang.Thread.run(Thread.java:856)
该方法写为:
public SoapPrimitive Base64ToImage(String base64String, String imgName) {
SoapPrimitive result = null;
try {
SoapObject request = new SoapObject("http://tempuri.org/",
"Base64ToImage");
request.addProperty("base64String", base64String);
request.addProperty("imgName", imgName);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);// soap envelop with version
envelope.setOutputSoapObject(request); // set request object
envelope.dotNet = true;
HttpTransportSE androidHttpTransport = new HttpTransportSE(url1);// http
// transport
// call
androidHttpTransport.call(
"http://tempuri.org/IService/Base64ToImage", envelope);
// response soap object
result = (SoapPrimitive) envelope.getResponse();
Log.e("Base64ToImage", result.toString());
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
我无法弄清楚究竟是什么问题。
请帮忙!提前谢谢!