LanguageSearchParameter

101 views
Skip to first unread message

qsd QDS

unread,
Sep 28, 2016, 6:53:11 AM9/28/16
to AdWords API Forum
Hi,

I'm trying to implement the TargetingIdeaService, since I'm using NodeJS and there is no official client I went with node-adwords.
I can't seems to figure out how to properly add a LanguageSearchParameter, it always return this error:

Unmarshalling Error: cvc-complex-type.2.4.a: Invalid content was found starting with element \'language\'. One of \'{"https://adwords.google.com/api/adwords/cm/v201607":id, "https://adwords.google.com/api/adwords/cm/v201607":type, "https://adwords.google.com/api/adwords/cm/v201607":Criterion.Type, "https://adwords.google.com/api/adwords/cm/v201607":code, "https://adwords.google.com/api/adwords/cm/v201607":name}\' is expected.

My selector looks like this:
let selector = {
  searchParameters
: [
   
{
      attributes
: {'xsi:type': 'RelatedToQuerySearchParameter'},
      queries
: ['test']
   
},
   
{
      attributes
: {'xsi:type': 'LanguageSearchParameter'},
      languages
: [{id: 1000}]
   
}
 
],
  ideaType
: 'KEYWORD',
  requestType
: 'IDEAS',
  requestedAttributeTypes
: ['KEYWORD_TEXT'],
  paging
: {startIndex: 0, numberResults: AdwordsConstants.RECOMMENDED_PAGE_SIZE},
}

And the full request sent:
<?xml version="1.0" encoding="utf-8"?>
    <soap:Header>
            <ns1:developerToken>***********</ns1:developerToken>
            <ns1:userAgent>node-adwords</ns1:userAgent>
            <ns1:validateOnly>false</ns1:validateOnly>
            <ns1:clientCustomerId>***********</ns1:clientCustomerId>
        </ns1:RequestHeader>
    </soap:Header>
    <soap:Body>
            <selector>
                <searchParameters xsi:type="RelatedToQuerySearchParameter">
                    <queries>test</queries>
                </searchParameters>
                <searchParameters xsi:type="LanguageSearchParameter">
                    <languages>
                        <id>1000</id>
                    </languages>
                </searchParameters>
                <ideaType>KEYWORD</ideaType>
                <requestType>IDEAS</requestType>
                <requestedAttributeTypes>KEYWORD_TEXT</requestedAttributeTypes>
                <paging>
                    <cm:startIndex xmlns:cm="https://adwords.google.com/api/adwords/cm/v201607">0</cm:startIndex>
                    <cm:numberResults xmlns:cm="https://adwords.google.com/api/adwords/cm/v201607">500</cm:numberResults>
                </paging>
            </selector>
        </get>
    </soap:Body>
</soap:Envelope>

I try sending the same request with both the official PHP and Python client and the requests are identical. What am I missing?

Vishal Vinayak (Adwords API Team)

unread,
Sep 28, 2016, 1:55:51 PM9/28/16
to AdWords API Forum
Hi,

Unfortunately, this looks like an issue in the third-party node.js library and I would not be able to help you with debugging the issue completely. However, I can see that there are namespace conflicts in the SOAP request XML generated by your code. If you compare the XML in your previous response with the XML below, you would see the namespace conflicts, specifically near the <searchParameters xsi:type="LanguageSearchParameter"> line. I would recommend fixing the namespace issues and trying again. If that doesn't work, I would recommend opening an issue in the Github repository of the node.js client library.

Sample SOAP request XML for Targeting Idea Service (generated with the AdWords API Java client library):

    <soapenv:Header>
        <ns1:RequestHeader xmlns:ns1="https://adwords.google.com/api/adwords/o/v201607" soapenv:mustUnderstand="0">
            <ns2:clientCustomerId xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201607">XXXXXXXXXX</ns2:clientCustomerId>
            <ns3:developerToken xmlns:ns3="https://adwords.google.com/api/adwords/cm/v201607">REDACTED</ns3:developerToken>
            <ns4:userAgent xmlns:ns4="https://adwords.google.com/api/adwords/cm/v201607">TestCompany (AwApi-Java, AdWords-Axis/2.19.0, Common-Java/2.19.0, Axis/1.4, Java/1.8.0-google-v7, maven)</ns4:userAgent>
            <ns5:validateOnly xmlns:ns5="https://adwords.google.com/api/adwords/cm/v201607">false</ns5:validateOnly>
            <ns6:partialFailure xmlns:ns6="https://adwords.google.com/api/adwords/cm/v201607">false</ns6:partialFailure>
        </ns1:RequestHeader>
    </soapenv:Header>
    <soapenv:Body>
            <selector>
                <searchParameters xmlns:ns7="https://adwords.google.com/api/adwords/o/v201607" xsi:type="ns7:RelatedToQuerySearchParameter">
                    <ns7:queries>some keyword</ns7:queries>
                </searchParameters>
                <searchParameters xmlns:ns8="https://adwords.google.com/api/adwords/o/v201607" xsi:type="ns8:LanguageSearchParameter">
                    <ns8:languages>
                        <ns9:id xmlns:ns9="https://adwords.google.com/api/adwords/cm/v201607">1000</ns9:id>
                    </ns8:languages>
                </searchParameters>
                <searchParameters xmlns:ns10="https://adwords.google.com/api/adwords/o/v201607" xsi:type="ns10:NetworkSearchParameter">
                    <ns10:networkSetting>
                        <ns11:targetGoogleSearch xmlns:ns11="https://adwords.google.com/api/adwords/cm/v201607">true</ns11:targetGoogleSearch>
                        <ns12:targetSearchNetwork xmlns:ns12="https://adwords.google.com/api/adwords/cm/v201607">false</ns12:targetSearchNetwork>
                        <ns13:targetContentNetwork xmlns:ns13="https://adwords.google.com/api/adwords/cm/v201607">false</ns13:targetContentNetwork>
                        <ns14:targetPartnerSearchNetwork xmlns:ns14="https://adwords.google.com/api/adwords/cm/v201607">false</ns14:targetPartnerSearchNetwork>
                    </ns10:networkSetting>
                </searchParameters>
                <ideaType>KEYWORD</ideaType>
                <requestType>IDEAS</requestType>
                <requestedAttributeTypes>KEYWORD_TEXT</requestedAttributeTypes>
                <requestedAttributeTypes>SEARCH_VOLUME</requestedAttributeTypes>
                <requestedAttributeTypes>CATEGORY_PRODUCTS_AND_SERVICES</requestedAttributeTypes>
                <paging>
                    <ns15:startIndex xmlns:ns15="https://adwords.google.com/api/adwords/cm/v201607">0</ns15:startIndex>
                    <ns16:numberResults xmlns:ns16="https://adwords.google.com/api/adwords/cm/v201607">10</ns16:numberResults>
                </paging>
            </selector>
        </get>
    </soapenv:Body>
</soapenv:Envelope> 

Regards,
Vishal, AdWords API Team

qsd QDS

unread,
Sep 29, 2016, 4:40:30 AM9/29/16
to AdWords API Forum

Thanks Vishal, problem solve.

If anyone have the same problem check this issue on github.
Reply all
Reply to author
Forward
0 new messages