3 messages in com.googlegroups.android-developersRe: New release M5: cannot anymore ca...| Subject: | Re: New release M5: cannot anymore call webservice!!!![]() |
|---|---|
| From: | kal (Paol...@gmail.com) |
| Date: | 02/28/2008 07:59:31 AM |
| List: | com.googlegroups.android-developers |
It occurs in
InputStream in = connection.getInputStream();
On 28 Feb, 09:54, Digit <digi...@gmail.com> wrote:
could you tell us where exactly the exception occurs ?
On Thu, Feb 28, 2008 at 9:27 AM, kal <Paol...@gmail.com> wrote:
Hello,
with the new release I cannot anymore invoke webservice using document style and standard JRE libraries; for example:
Authenticator.setDefault(new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication ("portaladmin", "kelm34".toCharArray()); } });
String requestXML="<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http:// schemas.xmlsoap.org/soap/envelope/\<http://schemas.xmlsoap.org/soap/envelope/%5C>" xmlns:SOAP-ENC=\"http:// schemas.xmlsoap.org/soap/encoding/\<http://schemas.xmlsoap.org/soap/encoding/%5C>" xmlns:xsi=\"http://www.w3.org/ 2001/XMLSchema-instance\ <http://www.w3.org/2001/XMLSchema-instance%5C>" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema \">"+ "<SOAP-ENV:Body>"+ "<m:getText xmlns:m=\"urn:Pdf2TextVi\">"+ "<m:document>"+miccia+"</m:document>"+ "</m:getText>"+ "</SOAP-ENV:Body>"+ "</SOAP-ENV:Envelope>";
URL ur = new URL("http://1.0.1.25:50000/Pdf2Text/getText? style=document <http://1.0.1.25:50000/Pdf2Text/getText?style=document>"); URLConnection uc = ur.openConnection(); HttpURLConnection connection = (HttpURLConnection) uc;
connection.setDoOutput(true); connection.setDoInput(true); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type","text/xml"); connection.setUseCaches(false); connection.setAllowUserInteraction(false); //connection.setRequestProperty("Content- Length",Integer.toString(requestXML.length()));
OutputStream out = connection.getOutputStream(); Writer wout = new OutputStreamWriter(out);
wout.write(requestXML);
wout.flush(); wout.close();
InputStream in = connection.getInputStream(); int c; String text=""; while ((c = in.read()) != -1)text+=(char)c; in.close(); String[] textI=text.split("<rpl:Response>"); textI=textI[1].split("</rpl:Response>"); text=textI[0]; text=text.replaceAll("
", "\n"); TextView risult = (TextView) findViewById(R.id.result); risult.setText(text);
This code work fine in M3 release and in any JAVA standalone program too, but not in android emulator...here I get a
'java.io.FileNotFoundException'....any idea?- Nascondi testo tra virgolette -




