Domotiga xml-rpc anomalies with ruby libraries

Forum about Domotiga Open Source Home Automation for Linux.

Moderator: RDNZL

Post Reply
tor
Starting Member
Starting Member
Posts: 2
Joined: Thu Nov 01, 2012 11:51 am

Domotiga xml-rpc anomalies with ruby libraries

Post by tor »

I've been playing (or at the very least trying to play) with the Domotiga xml-rpc interface from my favourite programming language Ruby.
This was initially not straightforward, as everything I tried led to error messages back from Domotiga.
It turns out that the standard header from the ruby xmlrpc library is

Header ->{"User-Agent"=>"XMLRPC::Client (Ruby 1.9.3)", "Content-Type"=>"text/xml; charset=utf-8", "Content-Length"=>"202"}

and Domotiga (or gambas I guess) does not recognise this and gives the error message :

" HTTP-Error: 415 Unsupported Media Type (RuntimeError)"

To make a long story short - if I remove the "charset+utf-8" bit from the Content-Type field everything works as the header is now :

Header ->{"User-Agent"=>"XMLRPC::Client (Ruby 1.9.3)", "Content-Type"=>"text/xml", "Content-Length"=>"100", "Connection"=>"keep-alive"}

Hope this can help others.
uAlex73
Member
Member
Posts: 218
Joined: Sun Jan 01, 2012 3:42 pm
Contact:

Re: Domotiga xml-rpc anomalies with ruby libraries

Post by uAlex73 »

I think this question is answered now in: http://www.domotiga.nl/boards/1/topics/705 ?

If you define text/xml, the charset has to be inside the XML request, not in the HTTP header. Thus DomotiGa XMLRPC (from gambas) is working fine.
DomotiGa / Z-Wave / RFXCom / Visonic PowerMaster / Home Assistant / Zigbee2MQTT / DSMR Reader / Toon1 (rooted)
tor
Starting Member
Starting Member
Posts: 2
Joined: Thu Nov 01, 2012 11:51 am

Re: Domotiga xml-rpc anomalies with ruby libraries

Post by tor »

The statement here was not really if the XMLRPC implementation was working correctly or not, rather about documenting a problem accessing domotiga from the standard Ruby libraries - I never stated that the Gambas XMLRPC was not working.

But even if we agree that the Gambas XMLRPC is working fine - it would help interoperability if Gambas XMLRPC did check for the presence of "Content-Type"=>"text/xml" within the header string, and ignored the extra charset field, and that would only be good programming practice.

Occasionally we have to take into account that not all implementations of a protocol are 100% compliant and add this to our software, maybe this could be one of those cases? Or is my documentation of the problem (and cause) enough?
uAlex73
Member
Member
Posts: 218
Joined: Sun Jan 01, 2012 3:42 pm
Contact:

Re: Domotiga xml-rpc anomalies with ruby libraries

Post by uAlex73 »

I would recommend to report it as bug/feature with gambas (http://gambas.sourceforge.net/).
DomotiGa / Z-Wave / RFXCom / Visonic PowerMaster / Home Assistant / Zigbee2MQTT / DSMR Reader / Toon1 (rooted)
Post Reply

Return to “DomotiGa Forum”