EventDay / Infusionsoft.net

A C# Wrapper around the Infusionsoft.com API
16 stars 22 forks source link

Error on .Update = A parameter is of, or contains an instance of, type System.Collections.Generic.Dictionary... which cannot be mapped to an XML-RPC type #52

Open hfloyd opened 7 years ago

hfloyd commented 7 years ago

When I pass a Dictionary of field names and field values into the client.ContactService.Update() method, I get an error:

CookComputing.XmlRpc.XmlRpcUnsupportedTypeException: A parameter is of, or contains an instance of, type System.Collections.Generic.Dictionary`2[System.String,System.Object] which cannot be mapped to an XML-RPC type
   at CookComputing.XmlRpc.XmlRpcRequestSerializer.SerializeRequest(Stream stm, XmlRpcRequest request) in :line 0
   at CookComputing.XmlRpc.XmlRpcClientProtocol.Invoke(Object clientObj, MethodInfo mi, Object[] parameters) in :line 0
   at XmlRpcProxy1cfb8f85-00dd-4b36-a037-50d149b56839.Update(String apiKey, Int32 contactId, IDictionary data)
   at InfusionSoft.ContactServiceWrapper.<>c__DisplayClass28.<Update>b__27(IContactServiceDefinition d) in \InfusionSoft\Wrappers\ContactServiceWrapper.cs:line 105

The code at that line is: return Invoke(d => d.Update(ApiKey, contactId, data));

Am I misunderstanding how to use the Update method? What sort of format does the IDictionary need to be in for this to work? I have tried Dictionary<string, object> and Dictionary<string, string> with the same result. Thanks for any assistance.

crmprocorp commented 7 years ago

I think you should bind using the sample I am providing var Data2= new XmlRpcStruct() { { "LastName", "Thamma" } ,{"FirstName","Bhaskar"}}; Also you need to add CookComputing.XmlRpcV2 you can find some where here or google it.

SoWaky commented 7 years ago

I had the same problem, but defining my query data as a XmlRpcStruct(){} instead of Dictionary<>() worked for me. Thanks!

lakhanighanshyam commented 2 years ago

Thanks @crmprocorp @SoWaky , My problem solved which i stuck since 1 day using, var Data2 = new XmlRpcStruct() { { "context", argsSalesInvoice } };