K6 (post a request with xml file as payload) Unmarshalling from [reader][XML] is impossible - JAXBException

Hello all :slight_smile:

I need help please, I’m usign K6 to perform load tests, so I need a post request with xml file as payload(like as below)- But I’ve an error
**
HTTP/1.1 400 BAD REQUEST
Unmarshalling from [reader][XML] is impossible - JAXBException issue group= iter=0 request_id=e9a4bd0f-e65a-451b-4e77-6f9019363afa scenario=default source=http-debug vu=1**

I don’t know how to fix it ? Have you any informations? thanks a lot for your help :slight_smile:

const xmlfile= open(‘./eecg-AT_compute_load_verif.xml’,‘b’);
const fd = new FormData();
fd.append(‘file’,http.file(xmlfile,‘file.xml’,‘xml’) )
const data = {
file:http.file(xmlfile,‘eecg’)};
let response = http.post(url,fd.body(), {
headers: { ‘Content-Type’: ‘application/xml ;boundary=’ + fd.boundary ,‘Accept’: ‘/’,
‘Authorization’: 'Bearer '+ dataa.accessToken}
});
check(response, {
‘post compute status is 200’: r => r.status == 200
})

I’ve found a very dirty workaround, is to make directly the file content in the script ! It works ! I think it exists a better solution :smiley: