Results 1 to 7 of 7
  1. #1
    grashmi13 is offline Member
    Join Date
    Sep 2010
    Posts
    16
    Rep Power
    0

    Default empty response received

    Hi Nikita Rybak,

    I am facing similar problem. from my application, i am sending GET request for an xml file to a UPNP device(a router). But response which is a INputStream is of size 0.

    Code used is:
    URLConnection uc = descriptionURL.openConnection();
    uc.connect();
    if (uc instanceof HttpURLConnection) {
    HttpURLConnection huc = (HttpURLConnection)uc;
    int statusCode = huc.getResponseCode();
    String statusMsg = huc.getResponseMessage();

    if (logger.isDebugEnabled()) {
    logger.debug("code="+statusCode+" msg="+statusMsg);

    int i = 1;
    String name = uc.getHeaderFieldKey(i);

    while (name != null) {

    if (logger.isDebugEnabled()) {
    logger.debug(" " + name + ": " + uc.getHeaderField(name));
    }

    name = uc.getHeaderFieldKey(++i);
    }
    }

    if (statusCode != 200) {
    throw new IOException("code="+statusCode+" msg="+statusMsg);
    }
    } // end if
    documentStream = uc.getInputStream();



    received InputStream size is 0 here. And headerInfo received is:
    code=200 msg=OK
    875247 [t Delivery Queue] DEBUG DeviceParser - CONTENT-LENGTH: 6263
    875247 [t Delivery Queue] DEBUG DeviceParser - CONTENT-TYPE: text/xml; charset="utf-8"
    875247 [t Delivery Queue] DEBUG DeviceParser - LAST-MODIFIED: Wed, 01 Jan 2003 01:01:18 GMT
    875247 [t Delivery Queue] DEBUG DeviceParser - DATE: Wed, 01 Jan 2003 01:01:18 GMT
    875247 [t Delivery Queue] DEBUG DeviceParser - SERVER: OpenRG/4.0.21.3.3.1.32.1.1.1.6 UPnP/1.0 SAGEM_LB/RG_VERSION
    875257 [t Delivery Queue] DEBUG DeviceParser - CONNECTION: close
    875257 [t Delivery Queue] INFO DeviceParser - documentStream : espial.net.misc.c@5dbaf9b size=0

    Please let me know you have any workaround or solution or reason for the same. port at which my application listen response, is getting valid xml. But this response is not recieved at application layer.

    Your help is most appreciated.

    Thanks
    Rashmi

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,172
    Rep Power
    20

    Default

    Please use code tags when posting code otherwise all formatting is lost.

    How do you determine the size of the input stream?
    I see no read statements in your code after you get the stream.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Three cross-posts, two locked. As noted above. Please abide by the rules you agreed to on joining this forum and post a question once in the single best forum. Cross-posting is not allowed.

  4. #4
    grashmi13 is offline Member
    Join Date
    Sep 2010
    Posts
    16
    Rep Power
    0

    Default

    @Moderators, I didnt read the rules and so posted same post in different categories. But from next time onwards I wont abide the rules of this website. Thanks for this information.

    @Tolls: First of all thanks a ton that you took this post seriously. I need its solution ASAP within 1-2 days period due to urgent requirement.
    I used following statement to print inputStream size:

    logger.info("documentstream: "+documentStream+" size="+documentStream.size());

    even, after this statement, I created a bufferedInputStream with this inputsteam. With the help of available() method, I set the mark to this bufferedInputstream and printed it using sysout and I got an empty string.

    Rashmi

  5. #5
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,789
    Rep Power
    25

    Default

    CONNECTION: close
    What is the meaning of this header field?

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,453
    Rep Power
    20

    Default

    Last edited by DarrylBurke; 09-17-2010 at 01:15 AM.

  7. #7
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. empty response received
    By grashmi13 in forum Advanced Java
    Replies: 2
    Last Post: 09-16-2010, 06:57 PM
  2. Who has received private message from codeforme
    By Fubarable in forum Forum Lobby
    Replies: 4
    Last Post: 04-13-2010, 04:00 AM
  3. detecting data received is malicious or not
    By prashant in forum Networking
    Replies: 2
    Last Post: 02-02-2009, 04:58 PM
  4. saving bytes received in different request
    By renuka_anil in forum Java Servlet
    Replies: 18
    Last Post: 12-26-2008, 01:12 PM
  5. saving bytes received in different request
    By renuka_anil in forum Advanced Java
    Replies: 3
    Last Post: 12-23-2008, 08:44 PM

Posting Permissions

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