Unable to retrieve data from http request

Hello all,
I am trying to retrieve data from an xml file on an ethernet-connected energy meter on my local network.
When I connect to the meter using a browser (Chrome) at 192.168.1.60/readings.xml and use the Developer window to look at the content I see the following:

<?xml version="1.0" encoding="ISO-8859-1"?>
<response>
<readings_instrument_values><![CDATA[<table class='parametersTable fullWidth'><tr class='tableRow'><td class='separatorCell' colspan='12'>REAL TIME</td></tr><tr class='tableRow'><td class='paramCell1'>V1N<div class='black'>=</div></td><td class='valueCell'><div class='numericalValue'>&nbsp;237.5</div>
// I've truncated this, suffice to say it's the data that I'm interested in
</readings_instrument_values>
</response>

The content also displays as a normal webpage with a browser-imposed title that reads:
"This XML file does not appear to have any style information associated with it. The document tree is shown below."
It then displays the entire content that is shown in the Developer window.

When I perform the same request using an http request node, I get the following payload as a string:

<?xml version="1.0" encoding="ISO-8859-1"?>
<response>
<readings_instrument_values></readings_instrument_values>
</response>

...or in other words it is missing the useful data that I expected to see between <readings_instrument_values> and </readings_instrument_values>

Can anyone suggest what I should be doing to get the http request to bring all of the content over? Or a different method to retrieve the data?
Any suggestions gratefully received.

It's possible this might be a bug with the debug sidebar and it's hiding the <![CDATA[...]> block.

If you set the debug node to output to the console as well as the sidebar and then check the logs to see it the whole mesage is there.

Thanks for the reply.

I've just tried this and it has the same output to the console as it does to the debug sidebar.

Also the string length of msg.payload is 127 characters, so there doesn't appear to be any "hidden" content...

I would check the headers being sent by the browser, and try to emulate them by passing msg.headers into your http request node... it could be that a header like this:

Accept: text/xml

causes the device to send more info than a bare http request? I've also seen that some devices look at the client string as well. It's also possible that while using the browser you received some cookies that are being sent back with each request.

And try fetching the page with curl

But the content does look strange, there should be no need to wrap the content in a <[CDATA[ block of it's just more XML

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.