Angular 4.3.4 httpclient returns null as subscribtion but I got a valid http response on the network

Viewed 1480

I'm trying to access a webservice that deliveres XML data back. In the past I used a node server backand that calls the external webservice without any problem.

Now my goal is to direct access the external webservice from my Angular 4.3.4 application with the new httpclient.

If I try to get data via get from a localhost rest service everything is working. But if I try to get the external service I have a strange behave: In the subscribtion I always get NULL as return value from the service but if I'm lookin on the network communication inside if chrome I see that data was tranfered correct with status 200.

httpClient.post(
  'http://www.fivb.org/Vis2009/XmlRequest.asmx',
  'Request=<Requests Username="Guest" >' +
  '<Request Type="GetBeachTournamentList" ' +
  'Fields="Code No Name CountryCode Gender NoEvent Type">' +
  '<Filter Types="36" />' +
  '</Request>' +
  '</Requests>',
  { headers: new HttpHeaders()
    .set('Accept', 'application/xml')
    .set('Content-Type', 'application/x-www-form-urlencoded;')
  })
  .subscribe(
    data => {
      // here I get null
      console.log(data);
    },
    err => {
      console.log(err);
    }
  );

would be great if someone have a idea

a full sample is available

2 Answers
Related