Thank you for your answer, but the problem is that some parts are in binary format and the ELFileBody corrupts binaries parts.
The workaround for this problem is to have a body method which takes as parameters List of sources
exec (http (“Request).post(” URI).Body (ELFilePartialBody (“part1.txt”) RawFilePartialBody (“part2.bin”), …) but I do not know if really relevant
I find a workaround that works, but that is not clean, by overriding the method visitEndOfHeader in class ByteArrayPart, FilePart and StringPart.
Exempe :
public class StringPartWithCustomHeader extends StringPart {
private final HeadersPart headersPart;
public StringPartWithCustomHeader(final String name, final String value, final HeadersPart headersPart) {
super(name, value);
this.headersPart = headersPart;
}
public StringPartWithCustomHeader(final String name, final String value, final String contentType, final HeadersPart headersPart) {
super(name, value, contentType);
this.headersPart = headersPart;
}
public StringPartWithCustomHeader(final String name, final String value, final String contentType, final Charset charset, final HeadersPart headersPart) {
super(name, value, contentType, charset);
this.headersPart = headersPart;
}
public StringPartWithCustomHeader(final String name, final String value, final String contentType, final Charset charset, final String contentId, final HeadersPart headersPart) {
super(name, value, contentType, charset, contentId);
this.headersPart = headersPart;
}
public StringPartWithCustomHeader(final String name, final String value, final String contentType, final Charset charset, final String contentId, final String transferEncoding, final HeadersPart headersPart) {
super(name, value, contentType, charset, contentId, transferEncoding);
this.headersPart = headersPart;
}
@Override
protected void visitEndOfHeader(PartVisitor visitor) throws IOException {
//Adding my headers before
headersPart.visitCustomdHeaders(visitor);
super.visitEndOfHeader(visitor)
}
}
My MultipartBody
–w6TmHRk-z1J3VAu3BiN8qnbuclBQFqI
Content-Disposition:
Content-Type: application/xop+xml; type="application/soap+xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-ID: <rootpart@soapui.org>
MyHeader: Myvalue
<soap:Envelope xmlns:soap=“http://www.w3.org/2003/05/soap-envelope”>
soap:Body
leav:xml
leav:param1${PARAM_1}</leav:param1>
leav:param2${PARAM_2}</leav:param2>
leav:param3${PARAM_3}</leav:param3>
</leav:xml>
</soap:Body>
</soap:Envelope>
–w6TmHRk-z1J3VAu3BiN8qnbuclBQFqI
Content-Disposition: attachment; name=“file.zip”; filename=“file”
Content-Type: application/zip; name=file.zip
Content-Transfer-Encoding: binary
Content-ID: <file.zip>
MyHeader1: Myvalue1
--w6TmHRk-z1J3VAu3BiN8qnbuclBQFqI--