Hello, If you'd like, you can generate a web reference from Visual Studio by following the steps outlined at
http://msdn.microsoft.com/en-us/library/d9w023sx.aspx The WSDL URLs are listed at the top of each service's documentation page. For instance, the AccountService WSDL URL is listed at the top of http://code.google.com/intl/en/apis/adwords/docs/developer/AccountService.html For v13 it's https://adwords.google.com/api/adwords/v13/AccountService?wsdl Cheers, -Jeff Posnick, AdWords API Team On Jan 25, 3:28 pm, "[email protected]" <[email protected]> wrote: > Hello Jeff > > I think I have the same problem as adchased, I've - > > - downloaded and built the google-api-adwords-dotnet project & added a > reference to the dll > - added AdWordsUser.cs to my ASP.NET web project > - amended the web.config so it includes the custom configuration > 'adwordsHeaders' section > - added login details that have worked in other test scripts > > but when I try and make a call to CampaignService I get the following > null > > System.ArgumentNullException: Value cannot be null. Parameter name: > type at System.Activator.CreateInstance(Type type, Boolean nonPublic) > at com.google.api.adwords.lib.AdWordsUser.getService(String name) at > CampaignServiceFuncs.AddCampaign() > > How can I switch to WSDL? > > Thanks > > JN > > On Dec 22 2008, 8:55 pm, adchased <[email protected]> wrote: > > > Thanks Jeff, I switched to WSDL now and it's working great! > > > ASP.NET Example: > > this.headers = (Hashtable) > > System.Web.Configuration.WebConfigurationManager.GetSection > > ("adwordsHeaders"); > > AdWordsUser user = new AdWordsUser(headers); > > > Cheers, > > Andreas > > > On Dec 19, 5:23 pm, AdWords API Advisor <[email protected]> > > wrote: > > > > Hello, > > > > There shouldn't be an issue with that code with the unmodified .NET > > > client library (it's used successfully by a decent number of > > > developers) and it's not something I could replicate. I can't tell you > > > exactly what's causing the GetType() call to return null in your > > > modified version of the code. I'd imagine that some possible causes > > > would be that the namespace for the assembly being loaded with GetType > > > () is somehow different (did you change any of the namespaces?) or > > > perhaps you're storing your custom AdUser() class in a different > > > location relative to the other assemblies and GetType() is relying > > > somehow on the location of the calling assembly to dynamically load > > > the helper assembly. > > > > But really, I'd suggest trying to use the standard .NET client > > > library. If you created a new class to handle reading the header > > > information differently, then you can just try using one of the > > > alternate constructors for AdWordsUser() that doesn't attempt to read > > > the header information from the application's config file, but instead > > > takes it as strings or a hash. > > > > Or, as another alternative, you can just forgo using the .NET client > > > library entirely and generate the .NET classes yourself from the > > > WSDLs--VisualStudio.NET makes that fairly easy, and that's all the > > > client library is (with a few niceties on top). > > > > Cheers, > > > -Jeff Posnick, AdWords API Team > > > > On Dec 18, 4:39 pm,adchased<[email protected]> wrote: > > > > > Hi Jeff, > > > > > yes, I created the AdUser Class, it's identical to AdWordsUser with > > > > one exception: It's an ASP.NET Application so I don't have an > > > > App.Config file. That's why my AdUser Class is reading from the > > > > Web.Config file via > > > > System.Web.Configuration.WebConfigurationManager.GetSection > > > > ("adwordsHeaders");. Everything else is identical. > > > > > I also checked if it's reading the values correctly and it does. I'm > > > > however stuck at > > > > > Type t = Type.GetType(PACKAGE_PREFIX + version + "." + name); > > > > > (t = null) > > > > > Thanks, > > > > Andreas > > > > > On Dec 18, 5:48 pm, AdWords API Advisor <[email protected]> > > > > wrote: > > > > > > Hello, > > > > > > I'm afraid I don't understand. Are you using the code provided in > > > > > the .NET client library? There's no mention of an AdUser class there, > > > > > so I'm not sure what you mean when you say it's identical to > > > > > AdWordsUser. Is this a custom class you've created? > > > > > > Cheers, > > > > > -Jeff Posnick, AdWords API Team > > > > > > On Dec 18, 4:05 am,adchased<[email protected]> wrote: > > > > > > > Hello Jeff, > > > > > > > yes. AdUser and AdWordsUser is in fact identical. I just had to > > > > > > change > > > > > > the header retrival to > > > > > > > ------- > > > > > > // Reads headers from App.config file > > > > > > this.headers = (Hashtable) > > > > > > System.Web.Configuration.WebConfigurationManager.GetSection > > > > > > ("adwordsHeaders"); > > > > > > ------- > > > > > > > As ASP.NET is using a web.config file instead of an App.config. > > > > > > Everything else is the same.. > > > > > > > On Dec 18, 12:11 am, AdWords API Advisor > > > > > > > <[email protected]> wrote: > > > > > > > Hello, > > > > > > > > Are you sure that that's the exact code you're running? You make > > > > > > > reference to an AdUser object, for instance, but the name of the > > > > > > > class > > > > > > > in the .NET Client Library is AdWordsUser. > > > > > > > > Cheers, > > > > > > > -Jeff Posnick, AdWords API Team > > > > > > > > On Dec 17, 5:45 pm,adchased<[email protected]> wrote: > > > > > > > > > Hello, > > > > > > > > > I'm using C# (within ASP.NET) for the Adwords API, this is how > > > > > > > > far I > > > > > > > > am until now: > > > > > > > > > --------------------------------------------------------------------------- > > > > > > > > --------------- > > > > > > > > using com.google.api.adwords.lib; > > > > > > > > using com.google.api.adwords.v12; > > > > > > > > ... > > > > > > > > > void AdApiTesting() > > > > > > > > { > > > > > > > > AdUser user = new AdUser(); > > > > > > > > user.useSandbox(); // use sandbox > > > > > > > > CampaignService campaignService = (CampaignService) > > > > > > > > user.getService("CampaignService");} > > > > > > > > > --------------------------------------------------------------------------- > > > > > > > > --------------- > > > > > > > > > It is crashing when I try to execute this line: > > > > > > > > CampaignService campaignService = > > > > > > > > (CampaignService)user.getService > > > > > > > > ("CampaignService"); > > > > > > > > > Specificly here: > > > > > > > > --------------------------------------------------------------------------- > > > > > > > > --------------- > > > > > > > > public object getService(String name) > > > > > > > > { > > > > > > > > object o = services[name]; > > > > > > > > if (null != o) > > > > > > > > { > > > > > > > > return o; > > > > > > > > } > > > > > > > > Type t = Type.GetType(PACKAGE_PREFIX + version + > > > > > > > > "." + > > > > > > > > name); > > > > > > > > o = Activator.CreateInstance(t); > > > > > > > > --------------------------------------------------------------------------- > > > > > > > > --------------- > > > > > > > > > t is null which is leading to an exception. > > > > > > > > > --------------------------------------------------------------------------- > > > > > > > > --------------- > > > > > > > > PACKAGE_PREFIX = "com.google.api.adwords." > > > > > > > > version = v12 > > > > > > > > name = CampaignService > > > > > > > > --------------------------------------------------------------------------- > > > > > > > > --------------- > > > > > > > > > These are my settings for the adwordsHeader: > > > > > > > > --------------------------------------------------------------------------- > > > > > > > > --------------- > > > > > > > > <adwordsHeaders> > > > > > > > > <add key="email" value="[email protected]"/> > > > > > > > > <add key="password" value="mypasswordXX"/> > > > > > > > > <add key="useragent" value="demotest"/> > > > > > > > > <add key="developerToken" > > > > > > > > value="[email protected]++eur"/> > > > > > > > > <add key="applicationToken" value="1234567890123456789012"/> > > > > > > > > <!-- Use either clientEmail or clientCustomerId (optional) > > > > > > > > --> > > > > > > > > <add key="clientEmail" value="[email protected]"/> > > > > > > > > <!-- <add key="clientCustomerId" > > > > > > > > value="INSERT_CLIENT_CUSTOMER_ID_HERE"/> --> > > > > > > > > <!-- Use alternateUrl to make calls against Sandbox > > > > > > > > (optional) --> > > > > > > > > <add key="alternateUrl" > > > > > > > > value="https://sandbox.google.com/"/> > > > > > > > > <!-- Specify absolute path of the directory to which SOAP > > > > > > > > logs > > > > > > > > should be > > > > > > > > saved (optional) --> > > > > > > > > <add key="logPath" value="C:\\Temp"/> > > > > > > > > </adwordsHeaders> > > > > > > > > --------------------------------------------------------------------------- > > > > > > > > --------------- > > > > > > > > > Could anyone help me out and tell me why t is NULL? > > > > > > > > > Thanks a lot! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en -~----------~----~----~----~------~----~------~--~---
