Hi, I'm facing the same problem exactly. Did you get this to work?

Cheers,
Bernardo

Quarta-feira, 26 de Setembro de 2012 13:45:41 UTC+1, Kiran escreveu:
>
> Hi,
>
>  
>
> We have a requirement in our project to get Client Customer ID. For this 
> we are calling AdWords API v201206 : 
> https://adwords.google.com/api/adwords/mcm/v201206. We are getting 
> following error from the service. Kindly let us know if anything is missing 
> in code posted below.
>
>  
>
> Kindly note : We are following approach of calling AdWords API v201206 
> with C# without using the AdWords API dotnet client library. 
>
> Reference : 
> https://code.google.com/p/google-api-adwords-dotnet/wiki/NoClientLibrary
>
>  
>
>  
>
> ERROR MSG : "The remote server returned an error: (500) Internal Server 
> Error."
>
>  
>
>  
>
> DETAILS : System.Net.WebException was caught
>
>   Message=The remote server returned an error: (500) Internal Server 
> Error.
>
>   Source=System
>
>   StackTrace:
>
>        at System.Net.HttpWebRequest.GetResponse()
>
>        at 
> DataSync.Component.GoogleClientCustomerIdManager.GetClientCustomerId()
>
>  
>
> CODE:
>
>  
>
> public static void GetClientCustomerId()
>
>         {
>
>             string authToken = GetAuthToken();
>
>             string developerToken = GetDeveloperToken();
>
>             string userAgent = GetUserAgent();
>
>  
>
>             string requestXml = string.Format(@" 
>
>                   <?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> 
>
>                       <RequestHeader xmlns='
> https://adwords.google.com/api/adwords/mcm/v201206'> 
>
>                         <authToken>{0}</authToken> 
>
>                         <developerToken>{1}</developerToken> 
>
>                         <userAgent>{2}</userAgent>
>
>                       </RequestHeader> 
>
>                     </soap:Header> 
>
>                     <soap:Body> 
>
>                       <get xmlns='
> https://adwords.google.com/api/adwords/mcm/v201206'>
>
>                           <serviceSelector>
>
>                             <fields>Login</fields>
>
>                             <fields>CustomerId</fields>
>
>                             <fields>Name</fields>
>
>                           </serviceSelector>
>
>                         </get>
>
>                     </soap:Body> 
>
>                   </soap:Envelope>",
>
>                 authToken,
>
>                 developerToken,
>
>                 userAgent).Trim();
>
>  
>
>  
>
>             WebRequest webRequest = HttpWebRequest.Create("
> https://adwords.google.com/api/adwords/mcm/v201206/ManagedCustomerService
> ");
>
>  
>
>             webRequest.Method = "POST";
>
>             webRequest.ContentType = "text/xml; charset=utf-8";
>
>             webRequest.Headers.Add("SOAPAction", "");
>
>             byte[] postBytes = Encoding.UTF8.GetBytes(requestXml);
>
>             webRequest.ContentLength = postBytes.Length;
>
>  
>
>             using (Stream strmReq = webRequest.GetRequestStream())
>
>             {
>
>                 strmReq.Write(postBytes, 0, postBytes.Length);
>
>             }
>
>             try
>
>             {
>
>                 WebResponse response = webRequest.GetResponse();
>
>  
>
>                 using (StreamReader reader = new 
> StreamReader(response.GetResponseStream()))
>
>                 {
>
>                     string responseXml = reader.ReadToEnd();
>
>                     XmlDocument xDoc = new XmlDocument();
>
>                     xDoc.LoadXml(responseXml);
>
>                     XmlNamespaceManager xmlns = new 
> XmlNamespaceManager(xDoc.NameTable);
>
>                     xmlns.AddNamespace("soap", "
> http://schemas.xmlsoap.org/soap/envelope/";);
>
>                     xmlns.AddNamespace("v201206", "
> https://adwords.google.com/api/adwords/mcm/v201206";);
>
>                     XmlElement faultNode =
>
>                         
> (XmlElement)xDoc.SelectSingleNode("soap:Envelope/soap:Body/soap:Fault", 
> xmlns);
>
>                     if (faultNode != null)
>
>                     {
>
>                         // Something went wrong with API call. Parse 
> faultNode for more details. 
>
>                     }
>
>                     else
>
>                     {
>
>                         XmlElement mutateResponseNode = 
> (XmlElement)xDoc.SelectSingleNode(
>
>                             "soap:Envelope/soap:Body/v201206:mutateResponse", 
> xmlns);
>
>                         // Parse mutateResponseNode contents to get the 
> campaign id. 
>
>                     }
>
>                 }
>
>             }
>
>             catch (WebException ex)
>
>             {
>
>                 throw new ApplicationException("Could not make Api 
> call.", ex);
>
>             }
>
>         }
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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



Reply via email to