跳转至内容
  • 版块
  • 标签
  • 热门
  • 用户
  • 群组
皮肤
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 默认(Flatly)
  • 不使用皮肤
折叠

Odoo 中文社区

  1. 主页
  2. 版块
  3. Odoo 开发与实施交流
  4. c#.net 调用xmlrpc 的例子

c#.net 调用xmlrpc 的例子

已定时 已固定 已锁定 已移动 Odoo 开发与实施交流
2 帖子 1 发布者 2.3k 浏览
  • 从旧到新
  • 从新到旧
  • 最多赞同
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • X 离线
    X 离线
    xiaonibaba
    写于 最后由 编辑
    #1
    <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 />
    
    1 条回复 最后回复
    0

    • 登录

    • 没有帐号? 注册

    • 登录或注册以进行搜索。
    • 第一个帖子
      最后一个帖子
    0
    • 版块
    • 标签
    • 热门
    • 用户
    • 群组