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.host}:${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.name} : ${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: ${resp.data}"

            log.debug resp.data.Xs 
            log.debug resp.data.Xs.X 
            log.debug resp.data.Xs.@D 
            resp.data.children().each { log.debug it.name }
            log.debug resp.data.inspect
        }
    } catch (e) {
        log.error "something went wrong: $e"
    }

The outputs I’m getting:

debug null
debug
debug
debug
debug
debug
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:

<Xs>
    <X D="248D8F250070"/>
</Xs>

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" ?> 
<Xs>
<X D="2400C9250000"/>
</Xs>

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

Returns

groovyx.net.http.HttpResponseDecorator@10d299b1

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

D="(.*)"

@slagle any ideas?