1
I have this message:
[{erro: "Formato de usuário inválido"}]
Typescript code
var headers = new Headers();
headers.append('Content-Type', 'application/x-www-form-urlencoded');
let urlSearchParams = new URLSearchParams();
urlSearchParams.append('user', 'meuLogin');
urlSearchParams.append('pass', 'minhaSenha');
urlSearchParams.append('cod', 'meuCodigo');
let body = urlSearchParams.toString()
return this.http
.post('meuXml.asp', body, {headers:headers})
.map(data => {
console.log(data.json())
}, error => {
console.log(error.json());
});
Content-Type
shouldn’t beapplication/xml
ortext/xml
?– Lucas
I also put that way you spoke, but error still persisted
– Douglas William
Take a look at this package https://www.npmjs.com/package/xml-js, your body in this case is a urlString, which is not in xml format
– Lucas
I have to convert from XML to JSON ?
– Douglas William
When you access the page
meuXml.asp
right in the browser what happens ?– NoobSaibot
It happens that it returns me the xml to send the data corresponding to each tag
– Douglas William