Skip to main content

empty response received

1 reply [Last post]
grashmi13
Offline
Joined: 2010-09-16
Points: 0

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

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
darrylburke
Offline
Joined: 2010-08-05
Points: 0