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

Sep 23, 2010 at 11:12 AM

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

Coordinator
Sep 23, 2010 at 9:40 PM

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