Error sending xml data

Asked

Viewed 22 times

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 be application/xml or text/xml ?

  • I also put that way you spoke, but error still persisted

  • 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

  • I have to convert from XML to JSON ?

  • When you access the page meuXml.asp right in the browser what happens ?

  • It happens that it returns me the xml to send the data corresponding to each tag

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.