Odoo中文社区可以通过以下三个域名访问:shine-it.net , odoocn.org,odoo.net.cn

原论坛用户的基本信息和发帖这里都予以保留,请注意:原论坛用户无需重新注册新用户,但是您的密码需要重置

开发人员可以登录gitter讨论组: http://gitter.im/odoo-china/Talk, 需要github账号

如果您登录系统碰到问题,请在微信公众号留言:

c#.net 调用xmlrpc 的例子



  • <br />using System;<br />using System.Collections.Generic;<br />using System.Linq;<br />using System.Web;<br />using System.Web.Services;<br />using CookComputing.XmlRpc;<br />using System.Configuration;<br /><br />namespace BPM.WebService<br />{<br />&nbsp; &nbsp; #region 头部定义<br />&nbsp; &nbsp; [WebService(Namespace = &quot;http://BPM/&quot;)]<br />&nbsp; &nbsp; [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]<br />&nbsp; &nbsp; [System.ComponentModel.ToolboxItem(false)]<br /><br />&nbsp; &nbsp; // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。<br />&nbsp; &nbsp; [System.Web.Script.Services.ScriptService]<br />&nbsp; &nbsp; #endregion<br />&nbsp; &nbsp; public class OpenErpRpc_Budget : BPM.WebService.BaseService<br />&nbsp; &nbsp; {<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; [XmlRpcUrl(&quot;http://192.168.168.217:8069/xmlrpc/common&quot;)]<br />&nbsp; &nbsp; &nbsp; &nbsp; public interface IOpenERPCommon : IXmlRpcProxy<br />&nbsp; &nbsp; &nbsp; &nbsp; {<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [XmlRpcMethod(&quot;login&quot;)]<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int Login(string DB, string USER, string PASS);<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; [XmlRpcUrl(&quot;http://192.168.168.217:8069/xmlrpc/object&quot;)]&nbsp; &nbsp;  <br />&nbsp; &nbsp; &nbsp; &nbsp; public interface IOpenERPObject : IXmlRpcProxy<br />&nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [XmlRpcMethod(&quot;execute&quot;)]<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; object execute(string dbname, int uid, string pwd, string className, string method, params string&#91;] args);<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; string database = ConfigurationSettings.AppSettings[&quot;xxys_database&quot;].ToString();<br />&nbsp; &nbsp; &nbsp; &nbsp; string user = ConfigurationSettings.AppSettings[&quot;xxys_user&quot;].ToString();<br />&nbsp; &nbsp; &nbsp; &nbsp; string password = ConfigurationSettings.AppSettings[&quot;xxys_password&quot;].ToString();<br />&nbsp; &nbsp; &nbsp; &nbsp; int uid = 0;<br /><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; public OpenErpRpc_Budget()<br />&nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IOpenERPCommon proxy = XmlRpcProxyGen.Create&lt;IOpenERPCommon&gt;();<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; uid = proxy.Login(database, user, password);<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; [WebMethod(Description = &quot;OPENERP的RPC调用&quot;)]<br />&nbsp; &nbsp; &nbsp; &nbsp; public object Execute(string className, string Method, params string&#91;] args)<br />&nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IOpenERPObject proxy2 = XmlRpcProxyGen.Create&lt;IOpenERPObject&gt;();<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; object ret2 = proxy2.execute(database, uid, password, className, Method, args);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return ret2;<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br /><br /><br /><br /><br />&nbsp; &nbsp; }<br />}<br /><br /><br />