如何检查xml-rpc是否正在使用OpenERP 7?

时间:2014-06-30 14:59:34

标签: openerp xml-rpc odoo

我试图弄清楚我的服务器是否接受xmlrpc请求。我所知道的是,当我尝试在浏览器上访问http://my_ip:8069/xmlrpc/commonhttp://my_ip:8069/xmlrpc/object时,我收到了一个"找不到文件错误"。这是预期的吗?
我是否必须使用任何标志启动服务器以启动xml-rpc支持?

这是我的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

我的起始剧本:

#!/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

2 个答案:

答案 0 :(得分:0)

您必须使用有效数据访问它。

Common(xmlrpc/common)用于连接目的,Object(xmlrpc/object)用于访问表和函数(模块)。

为此你可以使用Python,PHP,Java等创建一个api

例如,请检查此link

答案 1 :(得分:0)

要检查它你可以使用openerp-proxy项目,它可以用作使用xml-rpc或json-rpc的OpenERP / Odoo的lib或CLI客户端。

所以要测试你的连接:

$ 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

希望这会有所帮助