HTTP Binding - no valid HTTP response

Hi guys,

I´m facing a problem with HTTP Binding and a web relay (http://www.controlbyweb.com/webrelay-quad/)

The web relay offers a html page and an xml file for relay states. Because of data traffic reasons i would like to read the XML State file which looks like this:

<?xml version="1.0" encoding="UTF-8"?> <datavalues> <relay1state>0</relay1state> <relay2state>0</relay2state> <relay3state>0</relay3state> <relay4state>0</relay4state> </datavalues>

But it seems that the http binding does not like this response, because it is not a well formed http response. I´m always getting:

2016-03-29 14:08:58.155 [DEBUG] [.o.b.http.internal.HttpBinding] - item 'RelayStatus' is fetched from cache 2016-03-29 14:08:58.157 [DEBUG] [.o.b.http.internal.HttpBinding] - updating cache for 'webRelayCache' ('http://X.X.X.X/state.xml') 2016-03-29 14:08:58.165 [DEBUG] [g.openhab.io.net.http.HttpUtil] - About to execute 'http://X.X.X.X/state.xml' 2016-03-29 14:08:58.179 [ERROR] [g.openhab.io.net.http.HttpUtil] - Fatal protocol violation: org.apache.commons.httpclient.ProtocolException: The server X.X.X.X failed to respond with a valid HTTP response 2016-03-29 14:08:58.181 [ERROR] [.o.b.http.internal.HttpBinding] - No response received from 'webRelayCache'

Of course i could use the html user interface and parse the status out of a valid html table structure but i don´t like this solution that much.

So, isn´t it possible to retrieve the XML (not valid HTTP) response and transform it via XSLT?

Best regards,
Artur

Its possible to transform what the HTTP binding receives, but in this case it doesn’t like the result (i.e. it isn’t valid as far as it thinks) so it would never get to the transform.

The HTTP Binding and actions are great for very simple straight forward stuff. But anytime you get out of standard the HTTP Binding breaks down. In those cases I’ve seen most people then use curl called from the Exec binding or executeCommandLine action.

1 Like