×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Regular Contributor
    Join Date
    Mar 2004
    Posts
    154

    6230i Http problem.

    I am facing problem while using HTTP connection for the following Url on 6230i.

    String url= http://www.celiro.net/celiro/servlet/CeliroClient?xmlrequest=<celiroPacket><uei>354989-00-044951-8</uei><request><reqId>UPDATE</reqId><params><pItems><pItem><itemId>ALL</itemId></pItem></pItems></params></request></celiroPacket>

    Following is my code snippet.
    httpCon = (HttpConnection)Connector.open(url,Connector.READ,true);
    in = httpCon.openInputStream();// throws the exception here.

    When I try to use this url with browser it throws exception .Invalid web address.

    I dont understand what is the problem with this url.

  2. #2
    Regular Contributor
    Join Date
    May 2003
    Posts
    151

    Re: 6230i Http problem.

    Two things to try:

    1) are you sure those are valid characters in the url? If you put that URL into a PC browser it will convert the <> 's into '%3E' and '%3E'


    2) That's quite a long URL, and when the characters are converted it's even longer. You made find a lot of phones throw up when asked to connect to long URLs.

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    32

    Re: 6230i Http problem.

    Your URL is not valid as is and also is probably to long. Rather use HTTP post instead of get.

  4. #4
    Registered User
    Join Date
    Jun 2005
    Posts
    5

    Re: 6230i Http problem.

    Try Http POST ....POST will serve your purpose definetly . Good luck

  5. #5
    Regular Contributor
    Join Date
    Feb 2006
    Posts
    150

    Re: 6230i Http problem.

    Hi gpalvia, I'm working with HTTP connections and you have to take care with some things!

    I haven't read in the HTTP RFC http://www.w3.org/Protocols/rfc2616/rfc2616.html
    //http://www.w3.org/Protocols/rfc2616/rfc2616.html
    a limit for the number of characters in the URL. I'm not sure but I think that nowadays it isn't limited in the HTTP 1.1 version!

    I recommend you to revise those documents that I give you! (:-)--

    On the other hand, I've noted that in your snippet of code you don't use the setRequestMethod() and the setRequestProperty() methods. You need them to establish the "Request Method" (GET or POST) and the "Request Properties" (HTTP version, MIDP and CLDC versions, other customized headers...) which you want.

    I've included this snippet of code that I've checked in the Nokia 9500, N70 and N93 devices to help you:

    openHttpComm method:

    httpc = null;
    dis = null;
    dos = null;
    try {
    httpc =(HttpConnection)Connector.open(url,Connector.READ_WRITE);

    //Set the request method and headers
    httpc.setRequestMethod(HttpConnection.POST);
    httpc.setRequestProperty("Http-version","HTTP/1.1");
    httpc.setRequestProperty("Content-Language","es-ES");
    httpc.setRequestProperty("User-Agent","Profile/MIDP-2.0 Configuration/CLDC 1.1");

    //Create the stream DOS
    //dis=httpc.openDataInputStream(); //THIS LINE IS WRONG HERE! IT'LL FLUSH THE ACTUAL HTTP PACKET!
    dos=httpc.openDataOutputStream();
    dos.write(requestPayload);
    dos.flush();// Optional, getResponseCode will flush

    //Getting the response code will open the connection,
    // send the request, and read the HTTP response headers.
    // The headers are stored until requested.
    String m="HTTP/1.1 "+httpc.getResponseCode()+" "+httpc.getResponseMessage();
    if (httpc.getResponseCode()!=HttpConnection.HTTP_OK){
    throw new IOException (m);
    }
    ok=true;//The sending was successful!

    //------------------------------------------------------------------------------
    //READ THE DATA from the DataInputStream
    dis=httpc.openDataInputStream();//HERE IS THE CORRECT PLACE!!! --------
    readHttpData(data);//You must implement it!
    processData(data);//You must implement it too!
    //------------------------------------------------------------------------------

    I hope to help you to solve your question!

    Regards!
    Last edited by Summerman; 2006-10-02 at 17:58.

  6. #6
    Super Contributor
    Join Date
    Dec 2005
    Location
    Europe/Poland/Warsaw
    Posts
    1,697

    Re: 6230i Http problem.

    hi,

    exactly that way is outlined in Sun J2me tech tipc about http connection:
    http://developers.sun.com/techtopics...hod/index.html

    hth,
    regards,
    Peter

Similar Threads

  1. Another HTTP connection problem
    By issw in forum Mobile Java Networking & Messaging & Security
    Replies: 5
    Last Post: 2006-10-04, 16:36
  2. MP3 player problem on 6230i
    By Rich Pace in forum Mobile Java General
    Replies: 1
    Last Post: 2006-07-14, 22:45
  3. Problem with HTTP Post on S60
    By yigalbeer in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2006-05-28, 16:18
  4. 6230i & 6021 reboots on http open.
    By Martin Valfridsson in forum Mobile Java Networking & Messaging & Security
    Replies: 4
    Last Post: 2006-02-07, 14:00
  5. Replies: 2
    Last Post: 2003-02-19, 03:10

Posting Permissions

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