I think the url contains illegal characters like space (" ").
You should encode the url via URLEncode.encode(yourUrl, "UTF-8");
That will solve the problemOn 19 Jul., 20:21, "Mark S." <[email protected]> wrote: > I have a very simple working Java PC program that I try to run on Android. > The code access a web service with a simple SOAP call. > > I create the connection as follows: > > URL url = new URL("http://..."); > URLConnection urlConnection = url.openConnection(); > HttpURLConnection httpConnection = (HttpURLConnection) urlConnection; > > httpConnection.setDoOutput(true); > httpConnection.setDoInput(true); > httpConnection.setRequestMethod("POST"); > httpConnection.setRequestProperty("Content-Type", "text/xml; > charset=utf-8"); > httpConnection.setRequestProperty("Accept", "application/soap+xml, > application/dime, multipart/related, text/*"); > httpConnection.setRequestProperty("SOAPAction", "my action here"); > httpConnection.setConnectTimeout(timeout); > httpConnection.setReadTimeout(timeout); > > Then I send a request: > > OutputStream outputStream = httpConnection.getOutputStream(); > Writer writer = new OutputStreamWriter(outputStream); > writer.write(soapRequestXml); > writer.flush(); > writer.close(); > > and pick up the response as follows: > > InputStream inputStream = httpConnection.getInputStream(); // fails on > Android > StringBuilder soapResponseXml = new StringBuilder(); > int c; > while ((c = inputStream.read()) != -1) > soapResponseXml.append((char) c); > inputStream.close(); > > The httpConnection.getInputStream() fails with FileNotFoundException on > Android. > > Note: > > - The code snippet works perfectly when running on a PC. > - Accessing the outputStream seems to work fine (so there should be no > issues with the URL nor permissions?). > - The site is password protected which is handled in the code by a simple > Authenticator instance. > - Tested on the Android emulator only. > > Any clues why this fails on Android? > > Thanks! -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

