如何从android中的内部存储读取文件路径,并使用kso​​ap2将其作为参数发送到服务器

时间:2016-10-25 07:52:04

标签: android pdf ksoap2 internal-storage android-internal-storage

我必须发送12个参数,包括一个pdf文件,以生成已注册的pdf。

问题是,调试时我得到/data/filename.pdf但服务器没有读取文件路径。

并且在电话中,路径位置显示为/sdcard/filename.pdf

电话信息:marshmallow(API 23 +)

我需要做些什么来改变它的文件路径?

我尝试使用

1)Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)

2)

  File readpdfFile = new File(Environment.getDataDirectory() + File.separator +
                            "/NewPDF_.pdf");

                        propOne.setName("arg0");
                        propOne.setValue(readpdfFile);
                        request.addProperty(propOne);
// 11 other parameters similar as above
//soap method
 SoapSerializationEnvelope envelope2 = new SoapSerializationEnvelope(SoapEnvelope.VER11);
                new MarshalBase64().register(envelope2);
                envelope2.setOutputSoapObject(request);

                envelope2.implicitTypes = false;
                androidTransport = new HttpTransportSE(WSDL_URL);
                androidTransport.debug = true;
                androidTransport.call(SOAP_ACTION, envelope2);

                SoapObject response2 = (SoapObject) envelope2.bodyIn;
                String requestDump = androidTransport.requestDump;
                String responseDump = androidTransport.responseDump;

                Log.i("", "Request: " + requestDump);
                Log.i("", "Response: " + responseDump);

                outRes = response2.toString();

                pdfResult = outRes;
                Log.d("pdfResult  ", pdfResult);

            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            return pdfResult;
        }

0 个答案:

没有答案