Anil and Oleg thanks! That fixed it! -----Original Message----- From: Anil Pathak [mailto:[email protected]] Sent: Friday, October 15, 2010 6:33 PM To: HttpClient User Discussion Subject: Re: How do I set the request body for an HttpPost in 4.x
One way to use is StringBody http://hc.apache.org/httpcomponents-client-ga/download.html HttpClient client = new DefaultHttpClient(); MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); entity.addPart("xml", new StringBody("YOUR XML DATA")); HttpPost post = new HttpPost(url); post.setEntity(entity); ~Anil On Fri, Oct 15, 2010 at 11:11 AM, Nation, Carey <[email protected]>wrote: > I'm sure this is obvious and I'm sure I just didn't ask google the > proper question, but I'm stumped. > > > > I need to post a big blob of xml to a servlet. The xml needs to be in > the request body. In 3.x you said something like req.setBody( string). > I can't find anything like that in 4.x. I just need it to end up: > > > > Content-type: text/xml > > Content-length: yourLengthHere > > > > <xml /> > > > > Thanks! > > > > > > ________________________________ > > Carey Nation <mailto:[email protected]> Lead Software Engineer CNN > BEST Broadcast Production Systems Video Solutions Group > (404)827-2935 (wk) > (404)824-0033 (cell) > > ________________________________ > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
