Hi Anash, Thanks! I added the authToken to the code, that part is solved. However, now it seems that the SOAP is not correct. Could you please help yo find what I'm missing?
It gave an error in the line "AccountNew = createAccountService.mutate(New GoogleCreateAccountServiceSandbox.CreateAccountOperation() {operation})" Try Dim SOAP1 As New GoogleCreateAccountServiceSandbox.SoapHeader2 SOAP1.developerToken = "xxxxxxxxxx" Dim webRequest As Net.WebRequest = Net.HttpWebRequest.Create("https://www.google.com/accounts/ ClientLogin") webRequest.Method = "POST" webRequest.ContentType = "application/x-www-form- urlencoded" Dim postParams As String = "accountType=" & HttpUtility.UrlEncode("GOOGLE") & "&Email=" & HttpUtility.UrlEncode("o*****.com") & "&Passwd=" & HttpUtility.UrlEncode("*****") & "&service=" & HttpUtility.UrlEncode("adwords") & "&source=" & HttpUtility.UrlEncode(String.Format("{0}-{1}-{2}", "***", "***", "0.1")) Dim postBytes As Byte() = Encoding.UTF8.GetBytes(postParams) webRequest.ContentLength = postBytes.Length Using strmReq As Stream = webRequest.GetRequestStream() strmReq.Write(postBytes, 0, postBytes.Length) End Using Dim retVal As String = "" Try Dim response As Net.WebResponse = webRequest.GetResponse() Using reader As New StreamReader(response.GetResponseStream()) Dim sResponse As String = reader.ReadToEnd() Dim splits As String() = sResponse.Split(ControlChars.Lf) For Each split As String In splits Dim subsplits As String() = split.Split("="c) If subsplits.Length >= 2 AndAlso subsplits(0) = "Auth" Then retVal = subsplits(1) End If Next End Using Catch ex As Net.WebException Label1.Text = "Could not generate auth token." + ex.Message End Try Dim temp As String SOAP1.authToken = retVal SOAP1.userAgent = "CMS" temp = SOAP1.DidUnderstand temp = SOAP1.Role temp = SOAP1.ToString Dim createAccountService As New GoogleCreateAccountServiceSandbox.CreateAccountService Dim account As New GoogleCreateAccountServiceSandbox.Account() account.currencyCode = "EUR" account.dateTimeZone = "Europe/London" ' Create the operation. Dim operation As New GoogleCreateAccountServiceSandbox.CreateAccountOperation() operation.operator = [Operator].ADD operation.operand = account operation.descriptiveName = "Account created with CreateAccountService" Try ' Create the account. It is possible to create multiple accounts with ' one request by sending an array of operations. Dim AccountNew As GoogleCreateAccountServiceSandbox.Account() AccountNew = createAccountService.mutate(New GoogleCreateAccountServiceSandbox.CreateAccountOperation() {operation}) ' Display the results. If (Not AccountNew Is Nothing AndAlso AccountNew.Length > 0) Then Dim newAccount As GoogleCreateAccountServiceSandbox.Account = AccountNew(0) Label2.Text = newAccount.customerId Else Label2.Text = "No accounts were created." End If Catch ex As Exception Label2.Text = "Failed to create accounts. Exception says..." + ex.Message End Try Catch ex As Exception Label1.Text = ex.Message End Try On Feb 12, 11:23 pm, "Anash P. Oommen" <anash.p.oommen +fo...@google.com> wrote: > Hi Orlando, > > You need to mention the authToken header as well. > Seehttp://code.google.com/p/google-api-adwords-dotnet/wiki/NoClientLibra...for > details on how to get an authToken. Also, it might be worthwhile > investigating whether you can use the .NET library instead of writing your > own code. > > Cheers, > Anash P. Oommen, > AdWords API Advisor. -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and discussion group: http://adwordsapi.blogspot.com http://groups.google.com/group/adwords-api =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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