ScorpioTiger
ScorpioTiger

Reputation: 61

Why am I getting a 404 when accessing Odoo over XML-RPC?

I'm attempting to connect to Odoo 9 using XML-RPC. I've tried the url with xmlrpc/2/common, xmlrpc/common, and various other combinations. I'm only trying to get the version by passing version(), so authentication is not the issue. I'm using Nginx as reverse proxy and I've tried disabling Nginx and connecting directly to Odoo using various ports including the ones in the config. XML-RPC is enabled in my config file.

Haven't been able to post to the Odoo forums, and haven't had an answer from the IRC channel. I've now spent two days on this and could really use some help.

Can anyone confirm that xmlrpc/2/common is the correct path on Odoo 9?

Is there an Odoo instance somewhere that is known to work that I can try connecting to?

Upvotes: 0

Views: 5674

Answers (3)

ccdos
ccdos

Reputation: 1

One possible reason for this problem is that you need to make sure that the url only accesses one database. Because the database cannot be specified when common.version() is called. To do this, you can use the

  1. You do have only one database. or 2. with dbfilter configuration.

Upvotes: 0

themadmax
themadmax

Reputation: 2404

Odoo version 10:

Check your Odoo config file or command line

xmlrpc_interface = 0.0.0.0
xmlrpc = True
xmlrpc-port = 8069

Run this python code:

import xmlrpclib
common = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/2/common')
print common.version()

Upvotes: 1

Phillip Stack
Phillip Stack

Reputation: 3378

This seems like a networking issue. To troubleshoot the issue you should really have access to ideally your firewall, webserver logs (in your case nginx), and odoo logs. I will assume you have at least your webserver logs and odoo logs. Check your config and startup script to determine what port you are running xmlrpc on.

When you execute your xmlrpc commands view the incoming requests on odoo (ensure you have logging set to info or even better debug_rpc_answer). For docs on logging check out this. You should at least see the request successful or not on your logs. If you do not see the request at all then nginx is not forwarding properly (or firewall is blocking).

You really want to verify at every point that your request is getting through and then on the other end the response is coming back. Your firewall can let requests in but block outgoing if configured to do so.

import xmlrpclib
url = "localhost:8069"
common = xmlrpclib.ServerProxy('{}/xmlrpc/2/common'.format(url))
common.version()

If you cant run this on the host running your odoo server something is off. Check the port or if xmlrpc = True is enabled in your config. From there you can execute from another computer and then introduce your webserver.

Upvotes: 1

Related Questions