Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

341
Vistas
catch response in xml and convert it to JSON [Angular]

am actually interacting with a SOAP webservice which makes a POST request and returns a response with status 200 and an xml file, but when I want to catch that message I receive the following response: "SyntaxError: Unexpected token <in JSON at position 0 at JSON.parse () at XMLHttpRequest.onLoad "

service:

emision(body): Observable<any> {
    let httpOptions = {
      headers: new HttpHeaders({
        
        'Authorization': "*********",
        'Action': "postproduct",
       
      })
    };
    return this.http.post('/api/******',
      body, httpOptions)
}



subscribe:

 this.mainService.emision(obj).subscribe(
                  (value) => {
                    console.log(value);
                   
                  },
                  (error) => {
                    console.log(error);
                    console.warn(
                      "ERROR CONEXION"
                    );
                  }
);


Although when I enter the console and then in network I can verify that the response is with status 200 and a response in xml format, when I want to catch the response it generates an httpResponseError with the following message "SyntaxError: Unexpected token <in JSON at position 0 at JSON.parse () at XMLHttpRequest.onLoad "

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda