Found the problem, the fetch Content-Type default is not 'application/xml'. I added the following to the opt object and everything worked fine
var opt = {
'contentType': 'application/xml',
'method': 'POST',
'payload': xml,
'headers' : headers
};
It is worth nothing adding Content-Type
to the headers does not work