1

My requirement is to send and receive HTTP request and response from ISAPI dll which is hosted in IIS using Java. Our ISAPI dll sends raw xml data as response without http headers so when calling HTTPURLConnection.getinputstream() from client I am getting UnknownLengthHttpInputStream exception. Can I use HTTPURLConnection to read the http response data without header details or should I use sockets to read response in client?

Any help is appreciated.

Thanks.

Artem Mostyaev
  • 3,874
  • 10
  • 53
  • 60

1 Answers1

0

You just need to call HttpURLConnection.getInputStream() and read your xml data from there.

Jon Lin
  • 142,182
  • 29
  • 220
  • 220
  • Since my ISAPI is not sending http response header along with response while calling HTTPURLConnection.getInputStream() I am getting UnknownLengthHttpInputStream exception.Is it possible to read raw response body using HTTPURLConnection without the header details or should I go for any other approach like socket programming? – sujitha ram Aug 25 '12 at 14:42
  • @sujitharam if that's the case, then no, you can't use a HttpURLConnection because you're no longer compliant with the protocol. You'll need to just open a Socket and read from it. – Jon Lin Aug 25 '12 at 14:43