Reputation: 31
Use this code to get a data query to a server with openerp, and consulted with the proxy below but returns me this error, I'm new at this.
[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: An unhandled exception of type 'CookComputing.XmlRpc.XmlRpcTypeMismatchException' occurred in CookComputing.XmlRpcV2.dll
Additional information: fault response contains string value where integer expected [fault response : struct mapped to type Fault : member faultCode mapped to type Int32]
Upvotes: 3
Views: 3239
Reputation: 20693
OpenErp incorrectly returns faultCode as string message, it should be integer.
All you can do if you want to continue to use XmlRpc.NET is to download 3.0.0.270 beta version from here, that case is handled better in build 238. But be sure to set AllowStringFaultCode on your XmlRpcProxy:
clientProxy.NonStandard = XmlRpcNonStandard.AllowStringFaultCode;
Upvotes: 2