×

Discussion Board

Results 1 to 1 of 1
  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    2

    Did you find a solution about java.io.IOException with status -20019?

    I have also a similar problem: I have a midlet using a "Hello world" .NET web service. In the emulators (Nokia 60's family, Nokia 7210, Motorola,...) everything works fine.
    But when I run the midlet in a 7650 I have an java.io.IOException with error message "Unexpected end of stream". In order to know what of the sending or the receiving is the cause of the error, I have suppressed the reading of the response and then, I get a java.io.Exception with the message "status -20019".

    Did somebody find a solution about the status -20019?

    Here the run method of the thread managing the http connection:
    public void run() {
    HttpConnection conn = null;
    OutputStream out = null;
    InputStream in = null;
    ByteArrayOutputStream responseBytes = null;

    try {
    String soapMsg =
    "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
    "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:tns=\"http://tempuri.org/WebServiceTest/ODWS\" xmlns:types=\"http://tempuri.org/WebServiceTest/ODWS/encodedTypes\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
    "<soap:Body soap:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">" +
    "<HelloWorld />" +
    "</soap:Body>" +
    "</soap:Envelope>";

    byte[] bytes = soapMsg.getBytes();

    conn = (HttpConnection)Connector.open("http://193.247.212.7/webservicetest/odws.asmx");
    conn.setRequestMethod(HttpConnection.POST);
    conn.setRequestProperty("Content-Type", "text/xml; charset=\"utf-8\"");
    conn.setRequestProperty("Content-Length", String.valueOf(bytes.length));
    conn.setRequestProperty("SOAPAction", "http://www.contoso.com/HelloWorld");
    out = conn.openOutputStream();
    out.write(bytes);

    in = conn.openInputStream();
    responseBytes = new ByteArrayOutputStream();
    int ch;
    int i=0;
    while (i++<595) {
    responseBytes.write(in.read());
    }

    String resultStr = responseBytes.toString();
    System.out.println("Stream: " + resultStr);

    Form resultForm = new Form("Result...");
    resultForm.append(new StringItem("Stream: ", resultStr));
    Display.getDisplay(this.midlet).setCurrent(resultForm);
    Display.getDisplay(this.midlet).setCurrent(new TextBox("It is sent...", "coucou", 6, TextField.ANY));
    }

    catch (Exception e) {
    Form excepForm = new Form("Exception...");
    excepForm.append(new StringItem("Class: ", e.getClass().getName()));
    excepForm.append(new StringItem("Message: ", e.getMessage()));
    Display.getDisplay(this.midlet).setCurrent(excepForm);
    }
    finally {
    try {
    if (conn!=null) {
    conn.close();
    }
    if (out!=null) {
    out.close();
    }
    if (in!=null) {
    in.close();
    }
    if (responseBytes!=null) {
    responseBytes.close();
    }
    }
    catch (Exception e) {
    Form excepForm = new Form("Exception...");
    excepForm.append(new StringItem("Class: ", e.getClass().getName()));
    excepForm.append(new StringItem("Message: ", e.getMessage()));
    Display.getDisplay(this.midlet).setCurrent(excepForm);
    }
    }
    }

    P.S: just now, I have been able to run successfully the midlet in a Nokia 7210!
    Last edited by rogerG007; 2003-07-22 at 11:29.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×