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