0
我需要在我的React
應用程序中使用axios
向SOAP端點發出請求。因此,我需要在請求中傳遞xml數據並接收xml數據作爲響應。使用axios向SOAP端點發出請求
我已經使用jios數據的axios後,但我如何使用相同的XML? PFB我使用相同的代碼,但它不起作用。
JSON POST請求:
var xmlData = <note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
var config = {
headers: {'Content-Type': 'text/xml'}
};
axios.post('/save', xmlData, config);
,如果您有任何這方面的經驗,TIA請分享。
你試試這個:'頭:{ '內容類型': '應用程序/ XML'}' – DrunkDevKek
@DrunkDevKek:是的,我真的做到了,不行! –
您是否收到任何錯誤?也許你可以擴展你的意思,它不起作用。 –