This question has been flagged
3 Replies
18849 Views

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
Discard
Best Answer

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
Discard
Author

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.

Author Best Answer

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
Discard
Best Answer

Hi,

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

https://odoorestapi.azurewebsites.net/Help

 

Avatar
Discard
Author

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