我是c#和编程新手,开发API客户端通过xml-rpc与odoo API进行通信,在控制台中获取异常
错误响应包含字符串值,其中整数期望[错误响应:struct映射到类型错误:成员faultCode映射到类型Int32]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CookComputing.XmlRpc;
namespace ConsoleApplication1
{
[XmlRpcUrl("")]
public interface odoologin : IXmlRpcProxy
{
[XmlRpcMethod("login")]
int login(string dbName, string dbUser, string dbPwd);
}
class Program
{
static void Main(string[] args)
{
odoologin rpcClientlogin;
String host = "http://127.0.0.1:8069";
String UserName = "admin";
String pwd = "pdm@alligator";
String dbName = "demo";
rpcClientlogin = XmlRpcProxyGen.Create<odoologin>();
rpcClientlogin.Url= host + "/xmlrpc/object";
try
{
var userid = rpcClientlogin.login(dbName, UserName, pwd);
Console.WriteLine(userid);
}
catch (Exception ex )
{
Console.WriteLine(ex.Message);
}
Console.ReadLine();
}
}
}