'How to make a Post Request with XML using Axios?

I have a Network error with Axios, using the following code :

const getXMLNS = (number) => {
                    return (
                        '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="urn:gpsa:orias:ws.001">' +
                        '   <soapenv:Body>' +
                        '       <tns:intermediarySearchRequest>' +
                        '           <user>' +
                        'XXX' +
                        '</user>' +
                        '           <intermediaries>' +
                        '               <intermediary>' +
                        '                   <registrationNumber>' +
                        number +
                        '</registrationNumber>' +
                        '                </intermediary> ' +
                        '           </intermediaries> ' +
                        '       </tns:intermediarySearchRequest>' +
                        '   </soapenv:Body>' +
                        '</soapenv:Envelope>'
                    );
                };
                axios
                    .post('http://ws.orias.fr/service?wsdl', getXMLNS(number), {
                        headers:
                            { 'Content-Type': 'text/xml' },
                    }).then(res => {
                        alert("ok")
                    }).catch(err => alert(err));

The API is working, as I saw using PostMan. But It does not work on the ReactJS Front-End ...



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source