"One or more input elements failed validation." API V12 creating Campaign

7 views
Skip to first unread message

Siddharth

unread,
Jun 12, 2008, 11:47:05 AM6/12/08
to AdWords API Forum
Hi I am trying to create a SEM Campaign by passing the minimum
required parameters to addCampaign method.
Sometime the code doesnot throw error but doesn't create a campaign
Most of time it throws an error "One or more input elements failed
validation."

I would appreciate if you can review the following .NET code and help
me solving this problem. Please note that I am using appropriat
passwords and Token. I have not furnished the same with Code due to
security reasons.

Let me know if you need the same.

public void AddGoogleCampaign(decimal decDailyBudget)
{

CampaignService service=new CampaignService();
// Define SOAP headers.
service.emailValue = new email();
service.emailValue.Text = new String[]
{"chris.at.p...@gmail.com"};
service.passwordValue = new password();
service.passwordValue.Text = new String[] {"password"};
service.clientEmailValue = new clientEmail();
service.clientEmailValue.Text = new String[]
{"chris.at.p...@gmail.com"};
service.useragentValue = new useragent();
service.useragentValue.Text = new String[] {"Prospectics"};
service.developerTokenValue = new developerToken();
service.developerTokenValue.Text = new String[] {"Developer
Token"};
service.applicationTokenValue = new applicationToken();
service.applicationTokenValue.Text = new String[] {"Application
Token"};


int intCampaignIDAtGoogle = 0;

//*********************** Add Campaign *************************/


Campaign InputCampaignList = new Campaign();
InputCampaignList.name="Test V12 New Campaign 1";
//Convert daily budget from $ value to micro-units of $
long lngdailyBudget = Convert.ToInt64(decDailyBudget) * 1000000;

//first Parameter to add campaign Method
InputCampaignList.budgetAmount = lngdailyBudget;

InputCampaignList.budgetPeriod=BudgetPeriod.Daily;

//InputCampaignList.status =
Havana.GoogleCampaignService12.CampaignStatus.Paused;

//Add the campaign to company's account at Google.
Campaign OutputCampaignList =
service.addCampaign(InputCampaignList);
intCampaignIDAtGoogle = OutputCampaignList.id;
//*********************** Add Campaign *************************/


}

private void Button1_Click(object sender, System.EventArgs e)
{

this.AddGoogleCampaign(5);

}

Thanks
Siddharth Macwan
Developer - MCSD (.NET)

non-linear creations inc.
987A Wellington St., Suite 201, Ottawa, Ontario, Canada, K1Y 2Y1
tel: 613.241.2067 ext: 222 fax: 613.241.3086
http://www.nonlinear.ca | ac...@nonlinear.ca

AdWords API Advisor

unread,
Jun 12, 2008, 12:04:24 PM6/12/08
to AdWords API Forum
Hello Siddharth,

I'd need to see a log of the SOAP request and response messages (with
any password/token information removed) in order to determine what's
going on here. The SOAP fault that led to the exception is very
generic.

Cheers,
-Jeff Posnick, AdWords API Team


On Jun 12, 11:47 am, Siddharth <siddharthmac...@gmail.com> wrote:
> Hi I am trying to create a SEM Campaign by passing the minimum
> required parameters to addCampaign method.
> Sometime the code doesnot throw error but doesn't create a campaign
> Most of time it throws an error "One or more input elements failed
> validation."
>
> I would appreciate if you can review the following .NET code and help
> me solving this problem. Please note that I am using appropriat
> passwords and Token. I have not furnished the same with Code due to
> security reasons.
>
> Let me know if you need the same.
>
> public void AddGoogleCampaign(decimal decDailyBudget)
> {
>
> CampaignService service=new CampaignService();
> // Define SOAP headers.
> service.emailValue = new email();
> service.emailValue.Text = new String[]
> {"chris.at.prospect...@gmail.com"};
> service.passwordValue = new password();
> service.passwordValue.Text = new String[] {"password"};
> service.clientEmailValue = new clientEmail();
> service.clientEmailValue.Text = new String[]
> {"chris.at.prospect...@gmail.com"};

Siddharth

unread,
Jun 12, 2008, 1:29:32 PM6/12/08
to AdWords API Forum
Hi Jeff,

I am really struggling finding Soap tracker or a way to get U the SOAP
request and Response information.

Can you send me some reference which can help me to provide you this
information? My application is ASP.NET C# - .NET framework 1.1

Thanks

Siddharth
On Jun 12, 12:04 pm, AdWords API Advisor
> > tel: 613.241.2067 ext: 222  fax: 613.241.3086http://www.nonlinear.ca|  ac...@nonlinear.ca- Hide quoted text -
>
> - Show quoted text -

Reed

unread,
Jun 12, 2008, 1:37:34 PM6/12/08
to AdWords API Forum
Can you dump out and show us the rest of the XML that ws returned with
the error? It should spell out in detail the element that failed
validation, and the value of that element that the API choked on?

Siddharth

unread,
Jun 12, 2008, 2:01:06 PM6/12/08
to AdWords API Forum
-----SoapRequest at 6/12/2008 1:53:06 PM
<?xml version="1.0" encoding="utf-8"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/
XMLSchema"><soap:Header><applicationToken xmlns="https://
adwords.google.com/api/adwords/v12">urNNOmfPtIdfLpXYMBi6rA</
applicationToken><clientEmail xmlns="https://adwords.google.com/api/
adwords/v12">chris.at.p...@gmail.com</
clientEmail><developerToken xmlns="https://adwords.google.com/api/
adwords/v12">JCvMc3G-uh7LqjNGUd6HbA</developerToken><email
xmlns="https://adwords.google.com/api/adwords/
v12">chris.at.p...@gmail.com</email><password xmlns="https://
adwords.google.com/api/adwords/v12">ur2l84me</password><useragent
xmlns="https://adwords.google.com/api/adwords/v12">Prospectics</
useragent></soap:Header><soap:Body><addCampaign xmlns="https://
adwords.google.com/api/adwords/v12"><campaign><budgetOptimizerSettings
xsi:nil="true" /><contentTargeting>AllPlacements</
contentTargeting><enableSeparateContentBids>false</
enableSeparateContentBids><geoTargeting xsi:nil="true" /><id>0</
id><languageTargeting xsi:nil="true" /><name>Test V12 New Campaign 1</
name><networkTargeting xsi:nil="true" /><schedule xsi:nil="true" /
><status>Active</status></campaign></addCampaign></soap:Body></
soap:Envelope>
-----SoapResponse at 6/12/2008 1:53:10 PM
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/
envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<responseTime soapenv:actor="http://schemas.xmlsoap.org/soap/actor/
next" soapenv:mustUnderstand="0" xmlns="https://adwords.google.com/api/
adwords/v12">1358</responseTime>
<operations soapenv:actor="http://schemas.xmlsoap.org/soap/actor/
next" soapenv:mustUnderstand="0" xmlns="https://adwords.google.com/api/
adwords/v12">1</operations>
<units soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
soapenv:mustUnderstand="0" xmlns="https://adwords.google.com/api/
adwords/v12">1</units>
<requestId soapenv:actor="http://schemas.xmlsoap.org/soap/actor/
next" soapenv:mustUnderstand="0" xmlns="https://adwords.google.com/api/
adwords/v12">209ace3b14c64a4582d3481adc52bff5</requestId>
</soapenv:Header>
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server.userException</faultcode>

<faultstring>One or more input elements failed validation.</
faultstring>

<detail>
<ns1:fault xmlns:ns1="https://adwords.google.com/api/adwords/
v12">
<ns1:code>122</ns1:code>

<ns1:message>One or more input elements failed validation.</
ns1:message>

<ns1:errors>
<ns1:index>0</ns1:index>

<ns1:field>budget</ns1:field>

<ns1:code>34</ns1:code>

<ns1:isExemptable>false</ns1:isExemptable>

<ns1:detail>A budget must be specified for a new campaign.</
ns1:detail>

</ns1:errors>

</ns1:fault>

</detail>

</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>

-----SoapRequest at 6/12/2008 1:54:22 PM
<?xml version="1.0" encoding="utf-8"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/
XMLSchema"><soap:Header><applicationToken xmlns="https://
adwords.google.com/api/adwords/v12">urNNOmfPtIdfLpXYMBi6rA</
applicationToken><clientEmail xmlns="https://adwords.google.com/api/
adwords/v12">chris.at.p...@gmail.com</
clientEmail><developerToken xmlns="https://adwords.google.com/api/
adwords/v12">JCvMc3G-uh7LqjNGUd6HbA</developerToken><email
xmlns="https://adwords.google.com/api/adwords/
v12">chris.at.p...@gmail.com</email><password xmlns="https://
adwords.google.com/api/adwords/v12">ur2l84me</password><useragent
xmlns="https://adwords.google.com/api/adwords/v12">Prospectics</
useragent></soap:Header><soap:Body><addCampaign xmlns="https://
adwords.google.com/api/adwords/v12"><campaign><budgetOptimizerSettings
xsi:nil="true" /><contentTargeting>AllPlacements</
contentTargeting><enableSeparateContentBids>false</
enableSeparateContentBids><geoTargeting xsi:nil="true" /><id>0</
id><languageTargeting xsi:nil="true" /><name>Test V12 New Campaign 1</
name><networkTargeting xsi:nil="true" /><schedule xsi:nil="true" /
><status>Active</status></campaign></addCampaign></soap:Body></
soap:Envelope>
-----SoapResponse at 6/12/2008 1:54:22 PM
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/
envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<responseTime soapenv:actor="http://schemas.xmlsoap.org/soap/actor/
next" soapenv:mustUnderstand="0" xmlns="https://adwords.google.com/api/
adwords/v12">23</responseTime>
<operations soapenv:actor="http://schemas.xmlsoap.org/soap/actor/
next" soapenv:mustUnderstand="0" xmlns="https://adwords.google.com/api/
adwords/v12">1</operations>
<units soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
soapenv:mustUnderstand="0" xmlns="https://adwords.google.com/api/
adwords/v12">1</units>
<requestId soapenv:actor="http://schemas.xmlsoap.org/soap/actor/
next" soapenv:mustUnderstand="0" xmlns="https://adwords.google.com/api/
adwords/v12">4dd48d63278bb0c42d9c38437605cd7f</requestId>
</soapenv:Header>
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server.userException</faultcode>

<faultstring>One or more input elements failed validation.</
faultstring>

<detail>
<ns1:fault xmlns:ns1="https://adwords.google.com/api/adwords/
v12">
<ns1:code>122</ns1:code>

<ns1:message>One or more input elements failed validation.</
ns1:message>

<ns1:errors>
<ns1:index>0</ns1:index>

<ns1:field>budget</ns1:field>

<ns1:code>34</ns1:code>

<ns1:isExemptable>false</ns1:isExemptable>

<ns1:detail>A budget must be specified for a new campaign.</
ns1:detail>

</ns1:errors>

</ns1:fault>

</detail>

</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>

Siddharth

unread,
Jun 12, 2008, 2:15:29 PM6/12/08
to AdWords API Forum
Hi

In response detail its says "A budget must be specified for a new
campaign. "

If you refer my code that I sent you in my first post, I am passing
the

InputCampaignList.budgetAmount = lngdailyBudget

where variable lngdailyBudget value is traced to 5000000

any suggestion?
Thanks

Siddharth

On Jun 12, 1:37 pm, Reed <pow...@nauticom.net> wrote:

CFJ

unread,
Jun 12, 2008, 2:30:15 PM6/12/08
to AdWords API Forum
Try setting:
InputCampaignList.budgetAmountSpecified = true;
and also:
InputCampaignList.budgetPeriodSpecified = true;

Siddharth

unread,
Jun 12, 2008, 2:52:30 PM6/12/08
to AdWords API Forum
Thank you very much, I made it out and It worked after specifying the
following parameters to be true..

InputCampaignList.budgetAmountSpecified = true;
InputCampaignList.budgetPeriodSpecified = true;

Google update the V12 Documentation because now 4 parameters are
mandatary

I appreciate your time and Help on solving this issue.

Thanks
> > Siddharth- Hide quoted text -

AdWords API Advisor

unread,
Jun 12, 2008, 3:16:29 PM6/12/08
to AdWords API Forum
Hello Siddharth,

I'm glad the community was able to resolve the issue.

The *Specified attributes in .NET aren't actually parameters that get
passed in the SOAP messages and therefore aren't part of the API.
The .NET SOAP libraries are a bit quirky and require that you set
those attributes on the request parameters before they'll send over
the values.

Cheers,
-Jeff Posnick, AdWords API Team


Reply all
Reply to author
Forward
0 new messages