Few questions: Why not use a more appropriate entity type? ByteArrayEntity? StreamEntity?
How do you consume the response? Sendt fra min iPhone > Den 25. feb. 2015 kl. 17.26 skrev Alessandro Manzoni > <[email protected]>: > > I made a simple client that sends a xml stream to a webapp running on tomcat > 7 by POST method. > Both client and tomcat run on the same server (linux). HTTPClient version is > 4.2.2. > > The xml stream is formally correct. Somtimes, when the stream is more than > 30KB tomcat replies with an html page reporting 400 bad request. When the > stream is smaller goes fine. > > This is my code: > HttpClient httpclient = new DefaultHttpClient(); > HttpPost httppost = new HttpPost(uri); > StringEntity entity = new StringEntity(new > String(output.toByteArray()), ContentType.TEXT_XML); > httppost.setEntity(entity); > return httpclient.execute(httppost); > > where: > - uri is the uri of the webapp, always the same. > - output is a ByteArrayOutputStream that contains the xml stream > > Should I put some more headers? Or change somewhat to avoid the error? > > Thanks, regards. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
