CampaignServiceService service = new CampaignServiceService();
// set headers
String myUseragent = "xxx";
String myEmail = "xxx";
String myPassword = "xxx";
String myToken = "xxx++USD";
service.useragentValue = new useragent();
service.useragentValue.Text = new String[] { myUseragent };
service.emailValue = new email();
service.emailValue.Text = new String[] { myEmail };
service.passwordValue = new password();
service.passwordValue.Text = new String[] { myPassword };
service.tokenValue = new token();
service.tokenValue.Text = new String[] { myToken };
Campaign campaign = new Campaign();
// retrieve all campaigns and display the data
campaign.dailyBudget = 50000000;
campaign.name = "Testing 12345";
campaign.dailyBudgetSpecified = true;
service.addCampaign(campaign);
I get an internal error and it tells me to retry my request. Any
Ideas? The above code works on Live, but not Sandbox.
//begin code
this.m_ServiceSandbox = new Sandbox.CampaignServiceService();
this.m_ServiceSandbox.useragentValue = new Sandbox.useragent();
this.m_ServiceSandbox.useragentValue.Text = new String[] { "adwords
management" };
this.m_ServiceSandbox.emailValue = new Sandbox.email();
this.m_ServiceSandbox.emailValue.Text = new String[] {
"goo...@login.com" };
this.m_ServiceSandbox.passwordValue = new Sandbox.password();
this.m_ServiceSandbox.passwordValue.Text = new String[] { "password" };
this.m_ServiceSandbox.clientEmailValue = new Sandbox.clientEmail();
this.m_ServiceSandbox.clientEmailValue.Text = new String[] {
"client_...@login.com" };
this.m_ServiceSandbox.tokenValue = new Sandbox.token();
this.m_ServiceSandbox.tokenValue.Text = new String[] {
"goo...@login.com++USD" };
//end code
Any thoughts? I don't need a pound sign in my clientEmail, do I?
Thanks, Sean
No you don't, but unless you show us the actual XML being sent, it's
pretty much impossible to debug this any further.
Rich.
--
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com
<wsa:MessageID>uuid:4c40b389-7546-4559-af7a-478d423db0d2</wsa:MessageID>
<wsa:ReplyTo>
<wsa:Address>http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</wsa:Address>
</wsa:ReplyTo>
<wsa:To>https://sandbox.google.com/api/adwords/v4/CampaignService</wsa:To>
<wsse:Security>
<wsu:Timestamp
wsu:Id="Timestamp-ca4a8f76-ec75-43ae-85d7-3021214af388">
<wsu:Created>2006-08-17T12:53:48Z</wsu:Created>
<wsu:Expires>2006-08-17T12:58:48Z</wsu:Expires>
</wsu:Timestamp>
</wsse:Security>
</soap:Header>
<soap:Body>
<addCampaign xmlns="https://adwords.google.com/api/adwords/v4">
<campaign>
<dailyBudget>5000000</dailyBudget>
<enableSeparateContentBids>false</enableSeparateContentBids>
<geoTargeting xsi:nil="true" />
<id>0</id>
<languageTargeting>
<languages />
</languageTargeting>
<name>Campaign Test</name>
<networkTargeting>
<networkTypes>GoogleSearch</networkTypes>
</networkTargeting>
<status>Active</status>
</campaign>
</addCampaign>
</soap:Body>
</soap:Envelope>
Response:
<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:Body>
<soapenv:Fault>
<faultcode>soapenv:Server.generalException</faultcode>
<faultstring>An internal error has occurred. Please retry your
request.</faultstring>
<detail>
<ns1:code
xmlns:ns1="https://adwords.google.com/api/adwords/v4">0</ns1:code>
<ns2:message
xmlns:ns2="https://adwords.google.com/api/adwords/v4">An internal error
has occurred. Please retry your request.</ns2:message>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
I've tried several different google accounts. I've tried different
clients (client_1+, client_2+, etc.) I get the same error if I don't
include the clientEmail header at all. I've tried updating the
namespaces from adwords.google.com to sandbox.google.com and that
results in a different error stating that there is no email address in
the header, even though there is. The only thing I can think of is
that the accounts I'm using are not MCC accounts in production. I
didn't get the feeling from the breif sandbox doc that it had to be.
Can someone verify if that is the case? Can non-MCC production google
accounts be used in the sandbox?
Will Geith
For others using .Net and wanting to look at the xml that is being sent
and received, take a look at Web Services Enhancements (WSE).
http://msdn.microsoft.com/webservices/webservices/building/wse/
Will Geith
I wonder if these extra wsa and wsse headers are confusing things?
> <languageTargeting>
> <languages />
> </languageTargeting>
This snippet doesn't conform to a strict reading of the WSDL. In any
case you should supply a list of languages, or omit the
<languageTargeting> element completely.
Can you do simple stuff like just listing out campaigns?
I tried adding a language target and I still get the same response from
the sandbox.
<languageTargeting>
<languages>en</languages>
</languageTargeting>
I tried adding a geotarget, still fails.
<geoTargeting>
<countries>US</countries>
</geoTargeting>
I tried putting in bad values for the Geotarget and language targeting
(added xxx to the values), and then the error I get bounces between the
standard "Internal Error, please try again" and "The given 'token'
header is invalid." even though I am sending the exact same xml each
time.
Will
Thanks guys for looking into this.
Will
-Sean
The code I am using is:
com.google.sandbox.InfoService.InfoService service = new
com.google.sandbox.InfoService.InfoService();
// set headers
String myUseragent = "my company";
String myEmail = "lo...@mycompany.co.uk";
String myPassword = "password";
String myToken = "lo...@mycompany.co.uk++GBP";
service.useragentValue = new
com.google.sandbox.InfoService.useragent();
service.useragentValue.Text = new String[] { myUseragent };
service.emailValue = new com.google.sandbox.InfoService.email();
service.emailValue.Text = new String[] { myEmail };
service.passwordValue = new com.google.sandbox.InfoService.password();
service.passwordValue.Text = new String[] { myPassword };
service.tokenValue = new com.google.sandbox.InfoService.token();
service.tokenValue.Text = new String[] { myToken };
long usage = service.getFreeUsageQuotaThisMonth();
Where 'lo...@mycompany.co.uk' is the email I use to login to the MCC
(rather than the client account login).
This code seems to run fine but the sandbox accounts don't get
auto-generated.
Any thoughts?
How do you know? Are you trying a particular API call or getting an
error message?
Hi,
The api call is service.getFreeUsageQuotaThisMonth() in the code I
posted.
There is no error but when I log into my MCC the auto-generated
accounts are not there.
I may be missing the point here though. Are the auto-generated accounts
are not accessible though the MCC?
Peer Jakobsen