I have to send a POST request to a webservice with an XML Soap and a zip file attachment.
The result should be
POST /InvioTelematicoSS730pMtomWeb/InvioTelematicoSS730pMtomPort HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: multipart/related; type="text/xml"; start="<rootpart@soapui.org>";boundary="----=_Part_3_640244516.1446475016664"
SOAPAction: ""
Authorization: Basic VVpWUzZCV1M6UFhOREVLNlA=
MIME-Version: 1.0
Content-Length: 8036
Host: invioSS730pTest.sanita.finanze.it
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
------=_Part_3_640244516.1446475016664"
Content-Type: text/xml; charset=UTF-8"
Content-Transfer-Encoding: 8bit"
Content-ID: <rootpart@soapui.org>"
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ejb="http://ejb.invioTelematicoSS730p.sanita.finanze.it/">
<soapenv:Header/>
<soapenv:Body>
<ejb:inviaFileMtom>
<nomeFileAllegato>20141201-20141210_20151027182804.ZIP</nomeFileAllegato>
<pincodeInvianteCifrato>XXXXXXXXXXXXXXX</pincodeInvianteCifrato>
<datiProprietario>
<codiceRegione>000</codiceRegione>
<codiceAsl>000</codiceAsl>
<codiceSSA>88888888</codiceSSA>
<cfProprietario>PROVAX00X00X000Y</cfProprietario>
</datiProprietario>
<documento/>
</ejb:inviaFileMtom>
</soapenv:Body>
</soapenv:Envelope>"
------=_Part_3_640244516.1446475016664"
Content-Type: application/octet-stream"
Content-Transfer-Encoding: binary"
Content-ID: <20141201-20141210_20151027182804.ZIP>"
Content-Disposition: attachment; name="20141201-20141210_20151027182804.ZIP""
[file_content]
------=_Part_3_640244516.1446475016664--"
I've tried by creating an HttpRequest and after sets the header fields, i've used the LoadBodyFromString to load the XML object and the FILETOSTR of the zip, but it doesn't use the boundary so the result is not accepted. So i've tried by creating a MIME object, adding the xml and the file as parts (AppendParts); this return a MIME object with its own header and boundary, but i don't know how to load it in the HttpRequest object. Can someone help me?