0

I have to send 12 parameters including one pdf file to generate a registered pdf.

problem is that while debugging i get /data/filename.pdf but server not reading file path.

and in phone the path location is showing like /sdcard/filename.pdf

Phone info: marshmallow (API 23+)

what changes i need to make to read its file path?

i tried using

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;
        }
15
  • Use Environment.getExternalStorageDirectory(). Commented Oct 25, 2016 at 8:04
  • i used it.. but still it cant read it by server and response is null. plus updated the code for more simplification Commented Oct 25, 2016 at 9:12
  • Well have you checked if the file exist before sending its path to server? File readpdfFile. Use if (!readpdfFile.exists()){Toast to tell that the user; return;}. Commented Oct 25, 2016 at 9:26
  • Paths on your Android device cannot be read by servers on the internet. So it is pretty unclear what you are trying to accomplish. Should the path be read by the ksoap client instead to send its contents to the server? Commented Oct 25, 2016 at 9:27
  • if paths on device cannot be read by servers on internet, what should i do to read file from device and send it to server as parameter value.? Commented Oct 25, 2016 at 9:34

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.