I need to create a multipart request where one part has content-type "application/x-www-form-urlencoded" and contains data in name/value pairs (just like query string in GET requests). The other part has content-type "text/xml" and contains an XML document.
I have a form, which contains several text boxes (for username, password and other things related to my app). Additionally, there is a text area where a user can enter an app-specfic XML. If I set the "enctype" attribute of the form to "multipart/form-data", each of the values entered by the user go into a separate part of the multipart request.
Instead of this, I need the browser to create a multipart request that contains only two part: one part contains the user credentials in name/value pairs, clubbed together using '&' as in query string (say, username=max&password=f245f&...). The other part should contain the XML string.
But why the need to try and change what the browser will submit? Just write your server-side code properly to digest what the browser submits. That's what everyone else does. Why do you need something different?