Hi JohnM,

I think the selector isn't being recognized because it isn't in the
correct namespace.  Most elements in the request should be in the 'o'
namespace, while others should be in the 'cm' namespace.  Here is an
example SOAP XML request that works.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/
envelope/" xmlns:o="https://adwords.google.com/api/adwords/o/v200909";
xmlns:cm="https://adwords.google.com/api/adwords/cm/v200909";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
   <soapenv:Header>
      <o:RequestHeader>
         <cm:authToken>...</cm:authToken>
         <cm:clientEmail>...</cm:clientEmail>
         <cm:developerToken>...</cm:developerToken>
         <cm:userAgent>...</cm:userAgent>
      </o:RequestHeader>
   </soapenv:Header>
   <soapenv:Body>
      <o:get>
         <o:selector>
            <o:searchParameters
xsi:type="o:RelatedToKeywordSearchParameter">
               <o:keywords>
                  <cm:text>flowers</cm:text>
                  <cm:matchType>BROAD</cm:matchType>
               </o:keywords>
            </o:searchParameters>
            <o:searchParameters
xsi:type="o:LanguageTargetSearchParameter">
               <o:languageTargets>
                  <cm:languageCode>en</cm:languageCode>
               </o:languageTargets>
            </o:searchParameters>
            <o:searchParameters
xsi:type="o:CountryTargetSearchParameter">
               <o:countryTargets>
                  <cm:countryCode>US</cm:countryCode>
               </o:countryTargets>
            </o:searchParameters>
            <o:ideaType>KEYWORD</o:ideaType>
            <o:requestType>IDEAS</o:requestType>
            <o:paging>
               <cm:startIndex>0</cm:startIndex>
               <cm:numberResults>10</cm:numberResults>
            </o:paging>
         </o:selector>
      </o:get>
   </soapenv:Body>
</soapenv:Envelope>

Best,
- Eric Koleda, AdWords API Team

On Apr 1, 2:36 am, jem <[email protected]> wrote:
> I am using perl, no client lib, accessing TargetingIdeaService get
> method.  The selector is not being seen, as the selector.
>
> I am sure I am missing something really simple and stupid here.
>
> Here is the code:
>
> -----
> use Google::AdWords::AuthToken ();
> # ...
>       my $token;
>       eval {
>         $token = Google::AdWords::AuthToken::get_token({
>           email => $ADW_EMAIL,
>           password => $ADW_PASSWORD,
>         });
>       };
> # ...
>  my $service = 
> SOAP::Lite->service($wsdl)->autotype(0)->readable(1)->proxy($url);
>
> # ...
>       eval {
>         $service->on_fault(
>           sub {
>             my $response = $_[1];
>             $msg = "The following SOAP fault occurred:\n" .
>                    "    faultcode: " . $response->faultcode() . "\n" .
>                    "    faultstring: " . $response->faultstring() .
> "\n";
>             print $msg;
>           }
>         );
>       };
> # ...
>       my $soap_header = SOAP::Header->name('RequestHeader' =>
> \SOAP::Header->value(
>         SOAP::Header->name('authToken'        => $token),
>         SOAP::Header->name('clientEmail'      => $ADW_CLIENT_EMAIL),
>         SOAP::Header->name('userAgent'        => $ADW_USERAGENT),
>         SOAP::Header->name('developerToken'   =>
> $ADW_DEVELOPER_TOKEN),
>         SOAP::Header->name('applicationToken' =>
> $ADW_APPLICATION_TOKEN),
>         SOAP::Header->name('alternateUrl'     => 'https://adwords-
> sandbox.google.com'),
>       ));
> # tried setting soap_action...  and passing in for some tests, still
> didn't work
>       my $soap_action = SOAP::Data->name('get')->attr({'xmlns' =>
> $namespace});
> # ...
>           my $selector = SOAP::Data->name('selector' => {
>             'searchParameters' => [
>               {
>                 'type' => 'RelatedToKeywordSearchParameter',
>                 'keywords' => [
>                   {
>                     'text' => 'flowers',
>                     'matchType' => 'BROAD',
>                   },
>                 ]
>               },
>               {
>                 'type' => 'LanguageTargetSearchParameter',
>                 'languageTargets' => [
>                   {'languageCode' => $LANGUAGE},
>                 ]
>               },
>               {
>                 'type' => 'CountryTargetSearchParameter',
>                 'countryTargets' => [
>                   {'countryCode' => $COUNTRY},
>                 ]
>               },
>             ],
>             'ideaType'         => 'KEYWORD',
>             'requestType'      => 'IDEAS',
>             'paging'           => {
>               'startIndex'     => '0',
>               'numberResults'  => '10',
>             }
>           });
> # ...
>           my $som = '';
>           my $som_results = '';
>           eval {
>             $som = $service->get('TargetingIdeaSelector'=>$selector,
> $soap_header);
>             if (defined($som) && $som) {
>               $som_results = $som->result();
>             }
>           };
>           if ($@)  {
>             print "Error while making SOAP request for keyword\n";
>           }
> -----
>
> I am pretty sure the problem is the ->get() call.  I have tried
> several different soap service calls, using ->get (as shown above),
> and using the older ->call method as well, using the soap_action, to
> access the get method.
>
> I have tried ->get($selector,$soap_header), does not even see the
> $selector data,
> or with something as parameter #1 (as in the above call), I see the
> selector data, but the soap/wsdl interface does not see the selector
> as being the selector, as can be seen below in the soap debug output:
>
> soap debug results:
> -----
> SOAP::Transport::HTTP::Client::send_receive: 
> POSThttps://adwords-sandbox.google.com/api/adwords/o/v200909/TargetingIde...
> HTTP/1.1
> Accept: text/xml
> Accept: multipart/*
> Accept: application/soap
> Content-Length: 2454
> Content-Type: text/xml; charset=utf-8
> SOAPAction: ""
>
> <?xml version="1.0" encoding="UTF-8"?>
> <soap:Envelope
>     xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/";
>     soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
>     xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";
>     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
>     xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>     xmlns:xsd="http://www.w3.org/2001/XMLSchema";
>     xmlns:tns="https://adwords.google.com/api/adwords/o/v200909";>
>   <soap:Header>
>     <RequestHeader>
>       <authToken>xxxxxx</authToken>
>
>       <clientEmail>xxxxxx</clientEmail>
>
>       <userAgent>xxxxxx: AdWords API Perl Sample Code</userAgent>
>
>       <developerToken>xxxxxx</developerToken>
>
>       <applicationToken>xxxxxx</applicationToken>
>
>       <alternateUrl>https://adwords-sandbox.google.com</alternateUrl>
>     </RequestHeader>
>   </soap:Header>
>
>   <soap:Body>
>     <tns:get>
>       <selector xsi:nil="true" xsi:type="tns:TargetingIdeaSelector" />
>
>       <selector>
>         <ideaType>KEYWORD</ideaType>
>
>         <paging>
>           <startIndex>0</startIndex>
>
>           <numberResults>10</numberResults>
>         </paging>
>
>         <requestType>IDEAS</requestType>
>
>         <searchParameters>
>           <c-gensym12>
>             <keywords>
>               <c-gensym13>
>                 <text>flowers</text>
>
>                 <matchType>BROAD</matchType>
>               </c-gensym13>
>             </keywords>
>
>             <type>RelatedToKeywordSearchParameter</type>
>           </c-gensym12>
>
>           <c-gensym14>
>             <languageTargets>
>               <c-gensym15>
>                 <languageCode>en</languageCode>
>               </c-gensym15>
>             </languageTargets>
>
>             <type>LanguageTargetSearchParameter</type>
>           </c-gensym14>
>
>           <c-gensym16>
>             <countryTargets>
>               <c-gensym17>
>                 <countryCode>US</countryCode>
>               </c-gensym17>
>             </countryTargets>
>
>             <type>CountryTargetSearchParameter</type>
>           </c-gensym16>
>         </searchParameters>
>       </selector>
>     </tns:get>
>   </soap:Body>
> </soap:Envelope>
> -----
>
> Please let me know if you need additional information.
>
> Thanks!
>
> JohnM

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Have you migrated to v200909 yet?
The v13 sunset is on April 22, 2010.

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 [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

To unsubscribe, reply using "remove me" as the subject.

Reply via email to