I have used this code mod from some url here :
HttpConnection httpConnection = (HttpConnection) Connector.open(webservice_address,Connector.READ_WRITE);
Have you tried to avoid calling os.close() before reading the response?
os.close()