1

Closed

campaignCreate error using Xml-Rpc when some options aren't assigned

description

Hi,
 
I'm trying to create a campaign using the wrapper but I keep getting the same error.
 
Object reference not set to an instance of an object. at CookComputing.XmlRpc.XmlRpcStruct.Add(Object key, Object value) at PerceptiveMCAPI.Methods.campaignCreate.FormatCampaignOptions(campaignCreateOptions options) at PerceptiveMCAPI.Methods.campaignCreate.ExecuteXmlRpc()
 
This is my code:
 
campaignCreateInput input = new campaignCreateInput();
input.parms.type = PerceptiveMCAPI.EnumValues.campaign_type.regular;
input.api_Validate = false;
campaignCreateOptions options = new campaignCreateOptions();
options.from_email = "info@domain.com"; options.from_name = "Some Name";
options.list_id = "xxxxxxx";
options.subject = txtSubject.Text;
input.parms.options = options;
Dictionary<string, string> content = new Dictionary<string, string>();
content.Add("html", FCKeditor1.Value);
content.Add("text", "Lorem Ipsum");
input.parms.content = content;

campaignCreate cmd = new campaignCreate(input);
return cmd.Execute();
 
Where am I going wrong?
 
Thanks
 
 
 
Actually, this is my problem -- for xml-rpc, if the options aren't assigned by you, it's still assigning them as nulls in the XmlRpcStruct, instead of not assigning them at all.
And since xml-rpc doesn't handle nulls, you get that error. So 2 work arounds...
 
1) Switch to Serial access until the fix comes out.
 
2) assign empty strings to the following values, if you're not already assigning a value to them:
options.subject,
options.from_email,
options.from_name,
options.to_email,
options.title
 
Sorry about the problem.
 
David
Closed Dec 5, 2010 at 6:35 PM by davidmclusa
included as part of v1.2.5

comments

davidmclusa wrote Sep 24, 2010 at 2:20 AM

Since I'm in the middle of doing an update to the wrapper -- not related to any new MailChimp functionality -- I'll include this fix when I put out the other changes in Beta v1.2.5 -- about 7 - 10 days.

wrote Oct 3, 2010 at 5:09 AM

wrote Dec 5, 2010 at 6:35 PM

mmazeemahmad wrote Oct 25, 2011 at 3:21 PM

Hi could you tell me that how you have resolved the problem of CookComputing

wrote Feb 21, 2013 at 10:55 PM

wrote May 16, 2013 at 10:32 AM