Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

340
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!