Mi pregunta es como componer un mensaje Multiparte con la API HttpClient. Lo que quiero exactamente es que la primera parte sea un xml (Content-Type: application/xml), y la segunda un texto (Content-Type: text/html). Cuando hago la solicitud el servidor responde indicando que el tipo debe ser application/xml. Así se compongo el mensaje multiparte con apache httpclient
Código:
  
 El mensaje que debo componer es:StringPart xmlPart= new StringPart("xml", xml);
			xmlPart.setContentType("application/xml");
			StringPart textPart= new StringPart("text", "Hola mundo");
			textPart.setTransferEncoding("binary");
			textPart.setContentType("text/html");
			method.setRequestEntity(new MultipartRequestEntity(new Part[]{xmlPart,textPart}, method.getParams()));
Código:
  
y lo que me responde el servidor es: --PMasdfglkjhqwert
Content-Type: application/xml
<?xml version="1.0"?>
<!DOCTYPE pap PUBLIC "-//WAPFORUM//DTD PAP 2.1//EN" 
"http://www.openmobilealliance.org/tech/DTD/pap_2.1.dtd">
<pap>
  <push-message push-id="999999999"
                source-reference="AAAAAAAAAAAA"
                deliver-before-timestamp="2008-09-31T13:30:00Z"
                ppg-notify-requested-to="notify_url_path">
    <address address-value="PIN00001"/>
    <address address-value="PIN00002"/>
    <address address-value="PIN00003"/>
    <quality-of-service  delivery-method="confirmed"/>
  </push-message>
</pap>
--PMasdfglkjhqwert
Content-Encoding: binary
Content-Type: text/html
Text or binary content to be pushed to BlackBerry device goes here.
 --PMasdfglkjhqwert--
Código:
  
Por fa, no encuentro un ejemplo de como enviar un xml en contenido multiparte.<!DOCTYPE pap PUBLIC "-//WAPFORUM//DTD PAP 2.1//EN" "http://www.openmobilealliance.org/tech/DTD/pap_2.1.dtd"><pap><badmessage-response code="2000" desc="Received content type is not 'application/xml'" bad-message-fragment="Received content type is not 'application/xml'"/></pap>
Muchas gracias,
Saludos,
 
 


