This week's book giveaways are in the AI and JavaScript forums.
We're giving away four copies each of GANs in Action and WebAssembly in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Joe Ess
  • salvin francis
  • fred rosenberger

empty response received

Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Sasparilla and fresh horses for all my men! You will see to it, won't you tiny ad?
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!