Getting data from http request

Hi,
I have a problem getting my data from a http request. I can “console.log” them but i want to change a leaflet maps boundingbox with the data i get from my wms server. I tried it with an async function to wait for the response and set the bounds after that, but it is always undefined. I tried some promises but they did not really work too.

Here is some of my code with the last thing i’ve tried out.

async drawBounds(){
let coords = await this.httpProvider.xml()
L.latLngBounds([
{lat:coords[0], lng:coords[1]},
{lat:coords[2], lng:coords[3]}
])
}

xml() {
let url = ‘geoserver/wms?REQUEST=GetCapabilities’

return this.http.get(url)
.map(res => res.text()).subscribe(data => {
let coords = ;
// cut String at first coordinate
data = cutStartingpoint(data)
// and take the value
for (let i = 0; i <= 3; i++) {
coords[i] = parseFloat(cutEndOfNumber(data))
data = cutMiddle(data);
data = cutStartingpoint(data);
}
console.log(coords)
}
)
}

Thats the outcome:

Is there any way i can do something with the data? Do i have to use a factory for this? Im pretty new to all of this as you may have noticed. If someone can push me in the right direction or can tell me what i should try to learn to get this going, i would be very happy. Thanks in advance. :sweat_smile: