Parsing remote XML document via httpGet no output data

I’ve seen the topic here a bunch of times but none of the responses solved my problem.

I’m parsing a IOT device’s XML file. Here’s what I’ve got for code:

 def params = [
        uri: "http://${settings.username}:${settings.password}@${}:${settings.port}/sx.xml?${settings.deviceid}=1900",
        contentType: 'text/xml'

    try {
        httpGet(params) { resp ->
            // iterate all the headers
            // each header has a name and a value
            resp.headers.each {
               log.debug "${} : ${it.value}"

            // get an array of all headers with the specified key
            def theHeaders = resp.getHeaders("Content-Length")

            // get the contentType of the response
            log.debug "response contentType: ${resp.contentType}"

            // get the status code of the response
            log.debug "response status code: ${resp.status}"

            // get the data from the response body
            log.debug "response data: ${}"

   { log.debug }
    } catch (e) {
        log.error "something went wrong: $e"

The outputs I’m getting:

debug null
debug response data:
debug response status code: 200
debug response contentType: text/xml
debug Access-Control-Allow-Origin : *
debug Cache-Control : no-cache
debug Content-Type : text/xml
debug Connection : close

Here’s what the XML file looks like:

    <X D="248D8F250070"/>

Any help? @Ben ?

The only thing I can think of is that the XML returned is not standard. What the XML look like?

@slagle see the end of my original post

The <?xml variable is at the top as well

@slagle here’s the full output:

<?xml version="1.0" encoding="ISO-8859-1" ?> 
<X D="2400C9250000"/>

haha, I should have read 1 more line I guess lol.

I am not seeing anything wrong necessarily. is there anything in the response at all?

log.debug resp

It look like there is. Have you tried traversing a little farther? Could be that you aren’t going deep enough into the response but I am kind of grabbing at straws here as I am not seeing anything super out of the ordinary.

log.debug resp


Is there any way I can read it as text and extract it via regex


@slagle any ideas?