I have done sth similar.
Maybe it will help.
Code:
String data = "HERE IS XML FILE";
String path = "/servlet/xml";
osw.write("POST "+path+" HTTP/1.0\r\n");
osw.write("Content-Length: "+data.length()+"\r\n");
osw.write("Content-Type: application/x-www-form-urlencoded\r\n");
osw.write("Connection: keep-alive\r\n");
osw.write("\r\n");
osw.write(data);
osw.flush();
And it works fine.
BTW. for sure you dont need to POST xml file line by line.
M