I simply added to my c# program the web services
https://adwords.google.com/api/adwords/v13/InfoService?wsdl
and use it directly, works like a charm, here the full code of the
class:

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Xml;
using System.Net;

using GoogleClass.com.google.adwords4;
namespace GoogleClass
{

    public class Sh
    {
        private static String email = "sa...@salesharvester.com";
        private static String useragent =            "Sales
Harvester";
        private static String developerToken = "X";
        private static String applicationToken = "X";
        public static long ClientUsage(string password, string
clientEmail)
        {
            InfoService service1 = new InfoService();
            service1.emailValue = new
GoogleClass.com.google.adwords4.email();
            service1.emailValue.Text = new String[] { email };
            service1.passwordValue = new
GoogleClass.com.google.adwords4.password();
            service1.passwordValue.Text = new String[] { password };
//            service1.clientEmailValue = new
GoogleClass.com.google.adwords4.clientEmail();
//            service1.clientEmailValue.Text = new String[] { };//
clientEmail };
            service1.useragentValue = new
GoogleClass.com.google.adwords4.useragent();
            service1.useragentValue.Text = new String[] { useragent };
            service1.developerTokenValue = new
GoogleClass.com.google.adwords4.developerToken();
            service1.developerTokenValue.Text = new String[]
{ developerToken };
            service1.applicationTokenValue = new
GoogleClass.com.google.adwords4.applicationToken();
            service1.applicationTokenValue.Text = new String[]
{ applicationToken };
            DateTime today = DateTime.Today;
            DateTime startofmonth = today;
            while (startofmonth.Day > 1)
            {
                TimeSpan oneday = new TimeSpan(1, 0, 0, 0);
                startofmonth=startofmonth.Subtract(oneday);
            }
            String[] eMail = new String[] { clientEmail,"" };
            DateTime a = new DateTime(2009, 06, 01);
            DateTime b = new DateTime(2009, 06, 19);
            try
            {
                ClientUsageRecord[] ads =
service1.getUnitCountForClients(eMail, startofmonth, today); //
startofmonth,today);
                if (ads[0] != null)
                {
                    return ads[0].quotaUnits;
                }
            }
            catch (Exception e)
            {

                return totalLimit;
            }
            return 0;
        }

}
I use this code in a DLL that is called from my main program

using GoogleClass.com.google.adwords4;
is defined as:
https://adwords.google.com/api/adwords/v13/InfoService?wsdl



On Jun 26, 1:14 pm, AdWords API Advisor <adwordsapiadvi...@google.com>
wrote:
> Hello,
>
>  I take that to mean that you're not using the .NET client library
> (http://code.google.com/p/google-api-adwords-dotnet/), but rather
> generating the code yourself in Visual Studio from the WSDLs?
>
> Cheers,
> -Jeff Posnick, AdWords API Team
>
> On Jun 25, 3:41 pm, brazilian-cinema <sa...@brazilian-cinema.com>
> wrote:
>
> > I am using v13https://adwords.google.com/api/adwords/v13/InfoService?wsdl
>
> > On Jun 25, 2:41 pm, AdWords API Advisor <adwordsapiadvi...@google.com>
> > wrote:
>
> > > Hmm, looking though the group's archives, you're definitely not the
> > > first person to report odd behavior with getUnitCountForClients():
>
> > >  http://groups.google.com/group/adwords-api/browse_thread/thread/27920...
>
> > > Your current request looks like:
>
> > >   <getUnitCountForClients xmlns="https://adwords.google.com/api/
> > > adwords/v13">
> > >     <clientEmails>u...@domain.com</clientEmails>
> > >     <clientEmails/>
> > >     <startDate>2009-06-01</startDate>
> > >     <endDate>2009-06-24</endDate>
> > >   </getUnitCountForClients>
>
> > > So you have both a populated <clientEmails> element and an empty
> > > <clientEmails/> element. Based on some test requests I've made, it
> > > looks like the empty <clientEmails/> element is causing the failure
> > > (despite the fact that the documentation states that you can pass in
> > > an empty array for the clientEmails parameter).
>
> > > In any case, the code you posted at the start of this thread doesn't
> > > give much indication as to why the empty <clientEmails/> element would
> > > be serialized in your request. Are you using the official .NET Client
> > > Library, and if so, which version?
>
> > > Cheers,
> > > -Jeff Posnick, AdWords API Team
>
> > > On Jun 24, 6:29 pm, brazilian-cinema <sa...@brazilian-cinema.com>
> > > wrote:
>
> > > > I did as you suggested but with the same results.
> > > > Question in the password field I must use the MCC account password? in
> > > > this case I will be distributing my MCC password inside a dll and I do
> > > > not like truly the idea.
>
> > > > The new request id is id        7ce78a4f93fa4650efbfc64c57112a16
>
> > > > On Jun 24, 3:25 pm, AdWords API Advisor <adwordsapiadvi...@google.com>
> > > > wrote:
>
> > > > > Hello,
>
> > > > >  I looked up your request in our logs, and the error is due to the
> > > > > fact that you're including both your MCC account's email in the
> > > > > "email" SOAP header, and your AdWords account's email in the
> > > > > "clientEmail" SOAP header. This causes your call to be made from the
> > > > > context of your AdWords account.
>
> > > > >  The getUnitCountForClients() call should be made from the context of
> > > > > your MCC account, since in the request body you're asking for the
> > > > > usage of the AdWords account. Therefore, you should leave the
> > > > > "clientEmail" SOAP header blank and continue specifying your MCC's
> > > > > email in the "email" header.
>
> > > > > Cheers,
> > > > > -Jeff Posnick, AdWords API Team
>
> > > > > On Jun 24, 10:49 am, brazilian-cinema <sa...@brazilian-cinema.com>
> > > > > wrote:
>
> > > > > > 64bcb44a89f09b137097fa6f39a8c566
>
> > > > > > On Jun 24, 6:18 am, Zweitze <zwei...@gmail.com> wrote:
>
> > > > > > > When developing with .NET, you can either use Google's client 
> > > > > > > library,
> > > > > > > or just import the WSDL in your project and work with that. If 
> > > > > > > you did
> > > > > > > the latter (given your code it looks like that) Jeff needs the
> > > > > > > following:
>
> > > > > > > service1.requestIdValue.Text
>
> > > > > > > This property is set after any call to the Adwords API. It 
> > > > > > > contains a
> > > > > > > GUID-like identifier, that Google can use to find more 
> > > > > > > information in
> > > > > > > their logs.
>
> > > > > > > On Jun 23, 10:21 pm, brazilian-cinema <sa...@brazilian-cinema.com>
> > > > > > > wrote:
>
> > > > > > > > >  Could you turn on SOAP logging in the client library that 
> > > > > > > > > you're
> > > > > > > > > using, and pass along the value of the "requestId" SOAP 
> > > > > > > > > response
> > > > > > > > > header is in the SOAP error message you're getting back? With 
> > > > > > > > > that
> > > > > > > > > requestId I should be able to look up your request in our 
> > > > > > > > > logs and see
> > > > > > > > > exactly what's causing validation to fail.
>
> > > > > > > > Sorry I mjust be dense today, I am using .NET how do I switch 
> > > > > > > > one
> > > > > > > > logging? Or must I use some kind of soap message recorder 
> > > > > > > > (wireshark
> > > > > > > > or similar)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to 
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/adwords-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to