Skip to main content

empty response received

1 reply [Last post]
Joined: 2010-09-16

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();
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/ UPnP/1.0 SAGEM_LB/RG_VERSION
875257 [t Delivery Queue] DEBUG DeviceParser - CONNECTION: close
875257 [t Delivery Queue] INFO DeviceParser - documentStream : 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.


Reply viewing options

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