rashmigupta maheshwarigupta

Greenhorn
+ Follow
since Sep 16, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by rashmigupta maheshwarigupta

I am having similar code as posted in above thread. We are using java 1.1. Please let me know why am i getting content-length value null while getting length of input stream?

Also, can i use in.available in place of content-length value?

type of content from getInputStream is one or more xmls.
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
13 years ago
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
13 years ago
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