listMergeVarAdd Output returning Exception

Nov 9, 2010 at 5:45 PM

Hi,

I'm trying to create several MergeVar Fields in a MC List.

This is my code (the ListID is correct because I use it in other places):

Dim VarPOINTS As listMergeVarAddInput = New listMergeVarAddInput(ListID, "POINTS", "POINTS - Description")
Dim AddVars As listMergeVarAdd = New listMergeVarAdd(VarPOINTS)
Dim OutVar As listMergeVarAddOutput = AddVars.Execute()
Return OutVar.result
OutVar gives me the following exception:
"Object reference not set to an instance of an object.     at CookComputing.XmlRpc.XmlRpcStruct.Add(Object key, Object value)    
at PerceptiveMCAPI.Methods.listMergeVarAdd.FormatInput()    at PerceptiveMCAPI.Methods.listMergeVarAdd.ExecuteXmlRpc()"
--------------
I interact with other PerceptiveMCAPI methods (MC configuration in web.config) and everything works fine ecxept this.
Thanks for any help!
Hugo

 

Nov 9, 2010 at 6:15 PM

This is what I have in Web.config:

<MailChimpAPIconfig>
 <MCAPI
  SecureAccess="False"
  Validate="False"
  apikey="XXXXXXXXXXXXXXXXXXXXXXXXXX-us1" />
  </MailChimpAPIconfig>

Coordinator
Nov 9, 2010 at 6:42 PM

I've run your code against my account and it works fine... hmmm

The point it's failing at is where it creates & formats the XmlRpcStruct object to send to MailChimp -- which is pretty straight forward.

Hard to see how it could fail there, and yet it seems to, eh?

What version of the wrapper are you using? 

dbm

Nov 9, 2010 at 6:50 PM
Edited Nov 9, 2010 at 10:11 PM
I'm not at my computer right now but I downloaded the last one not in beta... I will confirm the exact version later today.

Enviado pelo telemóvel.
-- (Later) Hi, I'm using version v1.2.4.
Thanks,
Hugos 
Nov 9, 2010 at 10:41 PM
Edited Nov 9, 2010 at 10:42 PM

Hi,

I tried again in C# using the latest beta 1.2.5.1 - I also tried against several lists... allways same result.

Code:

listMergeVarAddInput VarPOINTS = new listMergeVarAddInput("XXXXXXXXXXXXXXXXXXXXXXXXXX-us1",ListID, "POINTS", "POINTS Description");
listMergeVarAdd AddVars = new listMergeVarAdd(VarPOINTS);
listMergeVarAddOutput OutVar = AddVars.Execute();


Exception (in the same place):

Object reference not set to an instance of an object. at CookComputing.XmlRpc.XmlRpcStruct.Add(Object key, Object value) at
PerceptiveMCAPI.Methods.listMergeVarAdd.FormatInput() in
C:\myProjects\Visual Studio 2008\PerceptiveMCAPI_CodePlex\PerceptiveMCAPI\trunk\List\listMergeVarAdd\listMergeVarAdd.cs:line 75 at
PerceptiveMCAPI.Methods.listMergeVarAdd.ExecuteXmlRpc() in
C:\myProjects\Visual Studio 2008\PerceptiveMCAPI_CodePlex\PerceptiveMCAPI\trunk\List\listMergeVarAdd\listMergeVarAdd.cs:line 57

Any help... greatly appreciated! :)

Hugo

Nov 9, 2010 at 11:02 PM

Hi,

I think I found out the problem (downloaded the source code):

Function FormatInput in listMergeVarAdd.cs expects that Input.parms.options.default_value is not null but as these parameters are optional in MC, I wasn't populating them.

Corrected it and the MergeVar fields are now correctly created in any list.

 

Thanks,
Hugo

 
Coordinator
Nov 9, 2010 at 11:52 PM

Muy interesante.

The .dll has a version number -- there were 4 versions of 1.2.4, please check the properties of the dll to see which it is; e.q. 1.2.4.3

regardless of that, I ran successfully on 1.2.4.3 & v1.2.5.1 -- so something else is going on. 

I need to have you (using the beta 1.2.5.1 please ) run the program in debug, step through to the listMergeVarAdd.FormatInput() function and find which

opts.Add("xxx", Input.parms.options.xxx)

statement it's puking out on.

Line 75 is the create of the XmlRpcStruct in the beta, but it appears to be getting an exception on trying  to add one of the options -- so I'm thinking that the stack trace above was from the 1.2.4.x version.

... and just for the hell of it, if you want to get passed this on a temp. basis, try running this command as serial/json instead of xml-rpc

 

dbm

Coordinator
Nov 10, 2010 at 12:05 AM

heh.  Got held up on a phone call and when I finally pressed enter (an hour later) you already gave the answer I was suspecting...

You SHOULD NOT have to initialized those parameters, and the input class provides default values (from the MCAPISettings) for the other values in the constructor of the options class, but apparently I expected the default_value property to default to an empty string, which it does for me, but apparently not in your case -- strange.

The default_value was the only property not explicitly initialized in the constructor so it pretty much had to be the culprit -- and I'll change that, but still it's bothers me that it didn't work in your case.

Thanks,

David

Nov 10, 2010 at 12:27 AM
No prob David,

I just have to thank you for your work. :)

Hugos


>
Coordinator
Nov 12, 2010 at 11:02 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.