Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Login to webservice using C#

By
Hans-Henrik G. Møller
on 11/27/14, 10:42 AM 4,195 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?  :-)

0
Sajin Aziz
On 11/29/14, 11:31 PM

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());
        }

 

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.

Hans-Henrik G. Møller
on 11/30/14, 7:27 AM
0

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.

0
Martin Schmid
On 11/30/14, 6:22 AM

Hi,

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

https://odoorestapi.azurewebsites.net/Help

 

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

Hans-Henrik G. Møller
on 11/30/14, 7:29 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 11/27/14, 10:42 AM
Seen: 4195 times
Last updated: 5/29/15, 4:30 AM