Bug #512

webclients : DomotiGa JSON-RPC returned HTTP Code=415, expected=200

Added by degerrit over 4 years ago. Updated about 4 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:
Won't Fix


Just upgraded from 1.0.016 to 1.0.019 - went pretty seamlessly with the upgrade instructions, thanks!

However, the web clients don't work after the upgrade - tried domotiga/ and iphone/
Get the same error message on both:

DomotiGa JSON-RPC returned HTTP Code=415, expected=200
I've fooled around a bit in functions.php with the curl_setopt options, but I can't get it to work.

- Client/Server mode
- OpenSuse 11.3 64-bit

Wireshark_follow_stream.txt (9.73 KB) Wireshark_follow_stream.txt degerrit, 12/11/2014 01:21 AM
Wireshark_follow_stream2.txt (8.14 KB) Wireshark_follow_stream2.txt degerrit, 12/11/2014 01:30 AM
ports9090_9009.txt (535 Bytes) ports9090_9009.txt degerrit, 12/11/2014 01:54 AM
GUI_settings_issue_512_XMLRPC_JSON.png (61.5 KB) GUI_settings_issue_512_XMLRPC_JSON.png degerrit, 12/11/2014 05:09 PM


#1 Updated by Alexie over 4 years ago

The 415 you get, when the content-type isn't correct. I checked the webclients and the content-type looks to be set properly?

curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));

It can be something in your OpenSUSE 11.3 setup (e.g. curl lib?). What do you see the webclient sending on HTTP level, which content-type is it using?

#2 Updated by degerrit over 4 years ago

You always challenge me with your questions, Alexie ;-)
I had to scratch my head a bit to figure out how to see what you are describing, but I think I got the needed info using tcpdump+wireshark: attached.

As I understand the code, the json.php script calls to JSON-RPC port 9090 (9009?!) and sends the parsed output to the web browser over port 80?

I think the relevant bit of the 3 then is in the TCP stream of attachment no, 3:

Host: localhost:9009
Accept: */*
Content-Type: application/json
Content-Length: 49

{"jsonrpc":"2.0","method":"housemode.get","id":1}HTTP/1.1 415 Unsupported Media Type
Server: Gambas XML-RPC Server
Connection: close
Content-Type: text/html; charset=iso-8859-1

For my own reference ;-) -
tcpdump -i eth0 src port not ssh and dst port not ssh and host not and not icmp and not arp and not udp -s 1024 -vvvv -w ~/domotiga_json.dump

#3 Updated by degerrit over 4 years ago

Hmmm, I believe I found the problem.

Somehow JSON-RPC is using port 9009 even though 9090 is configured.
I disabled XML-RPC, gave it another port - and then configured JSON-RPC to use 9009 instead (a hardcoded value?)

Seems to work...

#4 Updated by Alexie over 4 years ago

  • Status changed from New to Resolved
  • Assignee set to Alexie
  • Resolution set to Won't Fix

I think you found the reason/solution yourself already ;-) The JSON-RPC Client tried to communicate via port 9009, which is XML-RPC and expects a different content-type.

Only to configure the Client/Server, you need to do it in 2 places:
- JSON-RPC Server the port, normally 9090
- Menu -> Main -> GUI -> JSON-RPC Port, should be same as previous, port 9090

I am thinking to make it easier, because the Client/Server connect to the same DB, so it can read the port from it (JSON-RPC server) ;-)

#5 Updated by degerrit over 4 years ago


Hi Alexie, the setting you refer to is grayed out and set to XML-RPC on port 9009 :(
So, I can't change it - and I certainly don't remember doing so.

So, I'd be inclined to say that the upgrade (esp. the switch to JSON on the php side) breaks webclients configured this way, and it was not a misconfiguration on my side. I did not choose to use or not use JSON, the developers did ;-)

So the settings to make it "just work" should follow.

#6 Updated by Alexie over 4 years ago

The screenshot looks to show you are using the DomotiGa3.gambas in Server mode, not in Client mode. If select Program Mode" is "Client, then you can modify the other fields too.

Anyway, XML-RPC Client support is dropped in 1.0.020, no dual support anymore :P

#7 Updated by degerrit over 4 years ago

You are right, the client was in server mode, must have been like that for a long time now ... hmmm, strange that there had never been any strange side-effects until now! I usually use the web client, but occasionally also the DomotiGa3.gambas (especially for managing events) - works fine in server mode, as you say, probably because it is working on the same database as the 'real' server...

Well, anyway - if you could use the same port variable on both ends of the connection, that makes more sense. Cost me about 4 hours of sleep, this little issue :-P

#8 Updated by degerrit over 4 years ago

Aw, jeez - it's still not solved - it's even simpler than all of the above...
The web clients were updated to use JSON, but the existing config.php is left untouched, a new config.php.example is added though.

- $rpc_connect="http://localhost:9009";
+ $rpc_connect="http://localhost:9090";

There should be an upgrade warning about that :-)
Should it be added to ?

#9 Updated by jessekerkhoven about 4 years ago

  • Status changed from Resolved to Closed

Closing since it is more than 6 months in the config.php.example

Also available in: Atom PDF