2
使用此代码可以使用openerp向服务器获取数据查询,并与下面的代理进行协商,但返回此错误,我是新手。故障响应包含一个字符串值,其中整数是预期的
[XmlRpcUrl("//IP:port/xmlrpc/common")]
public interface IOpenERPRPCClient
{
[XmlRpcMethod("login")]
int autenticar(string db_name, string user, string passwd);
[XmlRpcMethod("execute")]
int[] buscar(string db_name, int uid, string passwd, string obj, string action, object[] filtro);
[XmlRpcMethod("execute")]
int [] eliminar(string db_name, int uid, string passwd, string obj, string action, int[] ids);
[XmlRpcMethod("execute")]
object[] read_objeto(string db_name, int uid, string passwd, string obj, string action, int[] ids, string[] campos);
}
private void button1_Click(object sender, EventArgs e)
{
int uid = autenticar();
IOpenERPRPCClient proxy_clientes = IOpenERPRPCClient)XmlRpcProxyGen.Create<IOpenERPRPCClient>();
IXmlRpcProxy cliente_rpc = (IXmlRpcProxy)proxy_clientes;
cliente_rpc.Url = "//IP:port/xmlrpc/object";
object[] filtro = { "'Active','=','True'" };
proxy_clientes.buscar("sgsoft", uid, "openerp", "res.partner","search",filtro);
}
ERROR:类型的未处理的异常“CookComputing.XmlRpc.XmlRpcTypeMismatchException”发生在CookComputing.XmlRpcV2.dll
其他信息:故障响应包含字符串值,其中整数预期[故障响应:STRUCT映射到类型错误:成员faultCode映射到Int32类型]
我只是猜测。 XML-RPC不是很流行。该消息表明问题在于服务器正在接收您的请求,但返回错误作为响应。错误响应似乎在'faultCode'字段中有一个字符串,但是.NET上的XML/RPC期望在那里有一个整数。我建议你使用Fiddler或类似的东西来查看网络并查看返回的内容。 – 2014-09-02 22:25:31