Я пытаюсь отправить XML-запрос на веб-службу и получить XML-ответ.
Ниже приведен мой код:
handleClick(MessageId) {
console.log(MessageId);
// this.setState({loading: true});
var serviceURL = 'http://192.168.2.13:8080/Service/com/xmlService';
let xmlString = '<?xml version="1.0" encoding="UTF-8"?><msgIdList><Id>'+MessageId+'</Id></msgIdList>';
console.log(xmlString);
axios({
method: 'post',
url: serviceURL,
data: xmlString,
config: { headers: {'Content-Type': 'application/xml;charset=UTF-8' }}
})
.then(response => {
//handle success
console.log(response);
})
.catch( response => {
//handle error
console.log(response);
});
}
Но ниже выдается ошибка:
415 (Unsupported Media Type) in browser.
То же самое работает с почтальоном.
Что я не так делаю ..?