I want to post some xml content and add an attachment (may be multiple files - docs etc) to an URL. This is to test a webservice call. I am using HttpURLConnection to achieve this and wirting the file contents to the output stream. This does not work as I am getting a 500 error. Please suggest me how do I post the files as attachment as well as the xml content(mandatory post content) to the stream(Output Stream).
Have you tried that one already? It's PostMethod can take call the setRequestEntity method with an instance of MultipartRequestEntity. This in turn can be created using a Part, and guess what - there are subclasses of Part called FilePart and StringPart. [ October 06, 2008: Message edited by: Rob Prime ]
Joined: Aug 07, 2008
I will try this.. I was trying the attachments posting using Java mail API..