Ir al contenido
Menú
Se marcó esta pregunta
3 Respuestas
19986 Vistas

Hi,

I am doing some work where I try and connect to the webservice of Odoo 8 through the XML RPC interface.

I am working off the documentation located here: https://www.odoo.com/documentation/8.0/api_integration.html#logging-in

In this documentation it states that the authentication method on the common endpoint returns an integer.. containing the uid. This does not seem to be true... I get a bool as a result.

Anybodý that has succesfully authenticated and recieved an uid? In that case..how?  :-)

Avatar
Descartar
Mejor respuesta

refer : http://xml-rpc.net/, add reference CookComputing.XmlRpcV2.dll file on your project in c#,


        using CookComputing.XmlRpc;
        [XmlRpcUrl("http://localhost:8069/xmlrpc/common")]
        public interface IOpenErpLogin : IXmlRpcProxy
        {
            [XmlRpcMethod("login")]
            int login(string dbName, string dbUser, string dbPwd);
        }
        private void button1_Click(object sender, EventArgs e)
        {
          
            //Login to openerp
            IOpenErpLogin rpcClientLogin = XmlRpcProxyGen.Create<IOpenErpLogin>(); //add  XmlRpcProxyGen.CS File from src folder if required,
            int userid = rpcClientLogin.login(dbname, userName, pwd);
            MessageBox.Show(userid.ToString());
        }

 

Avatar
Descartar
Autor

Hi Sajn Thank you for your help, but I am doing exactly as you are..except I recieve a bool as response from the login method. My code: public object Authenticate(string username, string password, string database) { var proxy = XmlRpcProxyGen.Create(); proxy.Url = string.Format("{0}{1}", this.Url, Constants.Extensions.Common); proxy.NonStandard = XmlRpcNonStandard.AllowStringFaultCode; return proxy.Authenticate(database, username, password, new string[] { }); } the object returned is a bool, and I have tried doing the same with the login method, with the same result. I try to connect to an instance of Odoo at Odoo.com, and wonder if the webservice has changed, and the documentation has not been updated. Because the documentation describes exactly what you are doing.

Autor Mejor respuesta

For reference. My problem was solved reading another post here.. that when creating an instance of a hosted Odoo on Odoo.com, you need to go and change the password of the user, before it actually can be "seen".

Doing that had my code working like a charm.

Avatar
Descartar
Mejor respuesta

Hi,

we create a mapper for xml-rpc to REST written in C#

https://odoorestapi.azurewebsites.net/Help

 

Avatar
Descartar
Autor

Hi Martin Thank you, I have already seen it, but I am more than capable of coding myself, except for the trouble with a difference between the documentation of Odoo, and the reality. /HH

Publicaciones relacionadas Respuestas Vistas Actividad
1
dic 16
3828
3
mar 15
6544
2
feb 21
6459
2
jun 17
12711
0
ene 16
6490