Sandeep
Sandeep

Reputation: 2593

Exception while making http request using LWUIT IO and J2me Library

I have made a method to make http request using LWUIT IO library and also tried with J2me library. Everything is working fine on simulator but when i tired on two different Nokia phones then i have received exception. Both are showing different exceptions. Exceptions-

  1. 411 length required
  2. java.io.IOException: Error in HTTP operation:Error in HTTP operation

Here is my code-

  private void startReq(String url) {
    NetworkManager.getInstance().start();
    ConnectionRequest myRequest = new ConnectionRequest() {
    protected void readResponse(InputStream input) throws IOException {
            StringBuffer stringBuffer = new StringBuffer();
            int ch;
            while ((ch = input.read()) != -1) {
                stringBuffer.append((char) ch);
            }
            System.out.println("Response:"+stringBuffer.toString());

        }
    };

    progress = new Progress("Please Wait ", myRequest,true);
    progress.setDisposeOnCompletion(true);


    myRequest.setUrl(url);
    myRequest.setPost(true);
    NetworkManager.getInstance().addToQueue(myRequest);
    progress.show();

}

Upvotes: 1

Views: 97

Answers (1)

Sandeep
Sandeep

Reputation: 2593

I have found the solution , it was problem related to Mobile Access Point. I could not recognize the problem because internet was working in browser very fine. so i could not guess that the reason can be Access Point. The problem was solved but still i am not satisfied and also surprised that how all applications were able to access internet service instead my Midlet.

Check this link to change access point settings

and if somebody knows the reason of this behavior kindly clear my doubt.

Upvotes: 1

Related Questions