This is the code that I'm using to make the call. You will not see any
specific XML handling code because I'm using WCF and it hides all the
SOAP/XML logic.

string auth = GetAuthToken(email, password);

            SoapHeader header = new SoapHeader();
            header.authToken = auth;
            header.clientEmail = clientEmail;
            header.developerToken = developerToken;
            header.applicationToken = applicationToken;
            header.userAgent = useragent;

            List<SearchParameter> parameters = new
List<SearchParameter>();

            RelatedToKeywordSearchParameter relatedSearchParameter =
new RelatedToKeywordSearchParameter()
 
{
 
keywords =
 
keywords.Select(x => new Keyword()
 
{
 
text = x,
 
matchType
 
=
 
matchType

                                                                                
                          }).ToArray
()

                                                                         };

            parameters.Add(relatedSearchParameter);

            if(includeAdultContent)
            {
                IncludeAdultContentSearchParameter
adultContentSearchParameter = new IncludeAdultContentSearchParameter
();
                parameters.Add(adultContentSearchParameter);
            }


            LanguageTargetSearchParameter
languageTargetSearchParameter = new LanguageTargetSearchParameter()
 
{
 
languageTargets =
 
languages.Select(
 
x => new LanguageTarget()
 
{
 
languageCode = x
                                                                                
               }).ToArray
()
                                                                              };
            parameters.Add(languageTargetSearchParameter);


            CountryTargetSearchParameter countryTargetSearchParameter
= new CountryTargetSearchParameter()
 
{
 
countryTargets =
 
countries.Select(
 
x => new CountryTarget()
 
{
 
countryCode = x
                                                                                
             }).ToArray
()
                                                                            };
            parameters.Add(countryTargetSearchParameter);


            TargetingIdeaSelector ideaSelector = new
TargetingIdeaSelector()
                                                     {
 
searchParameters = parameters.ToArray(),
                                                         ideaType =
IdeaType.KEYWORD,
                                                         requestType =
RequestType.IDEAS,
                                                         paging =
null,
                                                         localeCode =
"en_US",
                                                         currencyCode
= "USD"
                                                     };


            GoogleAdWords2009Api.TargetingIdeaServiceInterfaceClient
client = new TargetingIdeaServiceInterfaceClient
("TargetingIdeaServiceInterfacePort");
            TargetingIdeaPage ret;

            // This is the method that throw the Serialization
Exception
            client.get(header, ideaSelector, out ret);

I hope this will be useful to solve this problem.

Best,

Francesco

On Oct 29, 8:34 pm, AdWords API Advisor <adwordsapiadvi...@google.com>
wrote:
> Hi Francesco,
>
> Can you post some of the code you are using the build your request?
>
> Best,
> - Eric Koleda, AdWords API Team
>
> On Oct 29, 1:56 pm, phatzimo <francescosimones...@gmail.com> wrote:
>
>
>
> > Hi,
>
> > I'm trying to call the new API using c# and WCF. I'm able to create a
> > service reference using the Visual Studio WCF wizard and the program
> > is compiling gracefully. The issue is showing at runtime. When I try
> > to call the "get" method for a "TargetingIdeaService" I recive the
> > following Exception:
>
> > There was an error in serializing one of the headers in message
> > getRequest: 'Unable to generate a temporary class (result=1).
> > error CS0030: Cannot convert type
> > 'GoogleAdwordsClient.GoogleAdWords2009Api.Type_AttributeMapEntry[]' to
> > 'GoogleAdwordsClient.GoogleAdWords2009Api.Type_AttributeMapEntry'
> > error CS0029: Cannot implicitly convert type
> > 'GoogleAdwordsClient.GoogleAdWords2009Api.Type_AttributeMapEntry' to
> > 'GoogleAdwordsClient.GoogleAdWords2009Api.Type_AttributeMapEntry[]'
>
> > Anyone knows how to solve this issue?
>
> > P.S.: I was looking at the .net client library too but I prefer to use
> > the WCF implementation if possible.
>
> > Thanks,
>
> > Francesco
--~--~---------~--~----~------------~-------~--~----~
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