问题
I'm trying to figure out if my server is accepting or not xmlrpc request. What I know is that when I try to access http://my_ip:8069/xmlrpc/common
or http://my_ip:8069/xmlrpc/object
on my browser I get a "File not found error". Is that what is expected?
Do I have to start my server with any flag to start xml-rpc suport?
Here is my openerp-server.conf
admin_passwd = my_pass
db_host = False
db_port = False
db_user = openerp
db_password = False
addons_path = /opt/openerp/v7/addons,/opt/openerp/v7/web/addons,/home/lfc/openerp/v7/addons
;Log settings
logfile = /var/log/openerp/openerp-server.log
; log_level = error
log_level = debug
And my starting script:
#!/bin/sh
### BEGIN INIT INFO
# Provides: openerp-server
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Enterprise Resource Management software
# Description: Open ERP is a complete ERP and CRM software.
### END INIT INFO
PATH=/bin:/sbin:/usr/bin
DAEMON=/opt/openerp/v7/server/openerp-server
NAME=openerp-server
DESC=openerp-server
# Specify the user name (Default: openerp).
USER=openerp
# Specify an alternate config file (Default: /etc/openerp-server.conf).
CONFIGFILE="/etc/openerp-server.conf"
# pidfile
PIDFILE=/var/run/$NAME.pid
# Additional options that are passed to the Daemon.
DAEMON_OPTS="-c $CONFIGFILE"
# Added option to debug
#DAEMON_OPTS="-c $CONFIGFILE --debug --log-level=debug"
# Log File
LOGFILE=/var/log/openerp/openerp-server.log
[ -x $DAEMON ] || exit 0
[ -f $CONFIGFILE ] || exit 0
checkpid() {
[ -f $PIDFILE ] || return 1
pid=`cat $PIDFILE`
[ -d /proc/$pid ] && return 0
return 1
}
case "${1}" in
start)
#Check if deamon is already running
checkpid
if [ "$pid" != "" ]; then
echo "$NAME already running with pid $pid."
else
#Only starts if not running
echo -n "Starting ${DESC}: "
start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
--chuid ${USER} --background --make-pidfile \
--exec ${DAEMON} -- ${DAEMON_OPTS} --logfile=${LOGFILE}
echo "${NAME}, OK."
fi
;;
stop)
echo -n "Stopping ${DESC}: "
start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \
--oknodo
#Check existence of PID file. If exists, then remove it
checkpid
if [ "$pid" != "" ]; then
`rm ${PIDFILE}`
echo -n "${PIDFILE} removed "
fi
echo "${NAME}, Stoped!"
;;
restart|force-reload)
echo -n "Restarting ${DESC}: "
start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \
--oknodo
echo -n "\n${NAME}: STOPPED"
sleep 1
#Check existence of PID file. If exists, then remove it
checkpid
if [ "$pid" != "" ]; then
`rm ${PIDFILE}`
echo -n "\n${PIDFILE} REMOVED "
fi
sleep 1
start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
--chuid ${USER} --background --make-pidfile \
--exec ${DAEMON} -- ${DAEMON_OPTS}
echo "\n${NAME}: STARTED\n"
;;
*)
N=/etc/init.d/${NAME}
echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
回答1:
You have to access it with valid data.
Common (xmlrpc/common
) is for connection purposes and Object (xmlrpc/object
) is to access tables and functions (modules).
For that you can create an api using Python, PHP, Java, etc
For example check this link
回答2:
To check it You may use openerp-proxy project, which can be used as lib or CLI client to OpenERP / Odoo using xml-rpc or json-rpc.
So to test your connection:
$ pip install openerp_proxy # also install IPython if you like it
$ openerp_proxy # this will openen python/IPython shell
>>> db = session.connect() # This will ask you required info for connection
>>> db.registered_objects # this should return list of registered Openerp/Odoo models
Hope this will help
来源:https://stackoverflow.com/questions/24493087/how-do-i-check-if-xml-rpc-are-working-on-openerp-7