我有一个 web 服务 SOAP,我想在我的 Nexus 4 中通过 android 访问它。当我尝试像属性一样放置一个字符串路径时,我得到一个错误,soapfault:系统找不到指定的路径(或类似的东西)。
这是该方法的代码:
public void uploadImage() throws IOException, XmlPullParserException{
String path = pathImg;
String name = nomeImg;
SoapObject soap = new SoapObject(NAME_SPACE,"uploadImage");
soap.addProperty("pathImg", path);
soap.addProperty("nameImg", name);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.setOutputSoapObject(soap);
Log.i("NGVL", "Chamando UploadImage");
HttpTransportSE httptransport = new HttpTransportSE(URL);
httptransport.call(METHOD_UPLOAD_IMAGE, envelope);
Object msg = envelope.getResponse();
Log.i("NGVL", "Mensagem:" + msg);
}
这是 LogCat:
07-17 09:22:12.971: W/System.err(4090): SoapFault - faultcode: 'soapenv:Server' faultstring: '\storage\emulated\0\Pictures\Instagram\IMG_20130716_194320.jpg (The system cannot find the path specified)' faultactor: 'null' detail: org.kxml2.kdom.Node@422e1df0
07-17 09:22:12.971: W/System.err(4090): at org.ksoap2.serialization.SoapSerializationEnvelope.parseBody(Unknown Source)
07-17 09:22:12.971: W/System.err(4090): at org.ksoap2.SoapEnvelope.parse(Unknown Source)
07-17 09:22:12.971: W/System.err(4090): at org.ksoap2.transport.Transport.parseResponse(Unknown Source)
07-17 09:22:12.971: W/System.err(4090): at org.ksoap2.transport.HttpTransportSE.call(Unknown Source)
07-17 09:22:12.971: W/System.err(4090): at br.ufc.cloud.qnotes.ui.MainActivity.uploadImage(MainActivity.java:107)
07-17 09:22:12.971: W/System.err(4090): at br.ufc.cloud.qnotes.ui.MainActivity.createNote(MainActivity.java:119)
07-17 09:22:12.971: W/System.err(4090): at br.ufc.cloud.qnotes.ui.MainActivity$Task.doInBackground(MainActivity.java:204)
07-17 09:22:12.971: W/System.err(4090): at br.ufc.cloud.qnotes.ui.MainActivity$Task.doInBackground(MainActivity.java:1)
07-17 09:22:12.971: W/System.err(4090): at android.os.AsyncTask$2.call(AsyncTask.java:287)
07-17 09:22:12.971: W/System.err(4090): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
07-17 09:22:12.971: W/System.err(4090): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
07-17 09:22:12.971: W/System.err(4090): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
07-17 09:22:12.971: W/System.err(4090): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
07-17 09:22:12.971: W/System.err(4090): at java.lang.Thread.run(Thread.java:856)