You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unmarshalling Error: cvc-complex-type.2.4.a: Invalid content was found starting with element '{"https://adwords.google.com/api/adwords/cm/v201809":query}'. One of '{"https://adwords.google.com/api/adwords/cm/v201809":serviceSelector}' is expected.
#106
Open
Jared-Dahlke opened this issue
Mar 6, 2020
· 1 comment
Hello and thank you for the package Chris! I finally managed to get the authentication working but am now getting an error. Here is my code, followed by the error:
const AdwordsUser = require('node-adwords').AdwordsUser;
const refreshToken = '1/adsfasdfadadfadfadfadfadf'
const keys = require('../../GoogleAdsApiCredentials.json');
const {JWT} = require('google-auth-library');
`const client = new JWT(
keys.client_email,
null,
keys.private_key,
['https://www.googleapis.com/auth/adwords'],
);
const mytoken = await client.getAccessToken();
client.refreshToken(refreshToken)
let user = new AdwordsUser({
developerToken: keys.devToken, //your adwords developerToken
userAgent: 'myCompanyNqme', //any company name
clientCustomerId: '111-111-1111', //the Adwords Account id (e.g. 123-123-123)
client_id: '1231231231-4tao4aeumsg0hadsfasdfanpve.apps.googleusercontent.com', //this is the api console client_id
client_secret: 'adshjkflajsldfjaldjhfla',
refresh_token: refreshToken,
access_token: mytoken.token
});
let campaignService = user.getService('CampaignService', 'v201809')
let params = {
query: 'SELECT Id, Name'
};
campaignService.get(params, (error, result) => {
//console.log(JSON.stringify(result));
console.log(error)
})
here is the request body that the above code generates using this library: body: '<?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:tns="https://adwords.google.com/api/adwords/cm/v201809" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"><soap:Header><ns1:RequestHeader xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201809" xmlns="https://adwords.google.com/api/adwords/cm/v201809"><ns1:developerToken>adfadadffadf</ns1:developerToken><ns1:userAgent>Sightly</ns1:userAgent><ns1:validateOnly>false</ns1:validateOnly><ns1:clientCustomerId>111-111-1111</ns1:clientCustomerId></ns1:RequestHeader></soap:Header><soap:Body><get xmlns="https://adwords.google.com/api/adwords/cm/v201809"><query>SELECT Id, Name</query></get></soap:Body></soap:Envelope>'
and finally the error I am getting when I call this is below:
toJSON: [Function: responseToJSON],
caseless: Caseless { dict: [Object] },
body: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>Unmarshalling Error: cvc-complex-type.2.4.a: Invalid content was found starting with element '{"https://adwords.google.com/api/adwords/cm/v201809":query}'. One of '{"https://adwords.google.com/api/adwords/cm/v201809":serviceSelector}' is expected. </faultstring></soap:Fault></soap:Body></soap:Envelope>
},
body: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>Unmarshalling Error: cvc-complex-type.2.4.a: Invalid content was found starting with element '{"https://adwords.google.com/api/adwords/cm/v201809":query}'. One of '{"https://adwords.google.com/api/adwords/cm/v201809":serviceSelector}' is expected. </faultstring></soap:Fault></soap:Body></soap:Envelope>
}
Hopefully someone can help. Thank you
The text was updated successfully, but these errors were encountered:
Hello and thank you for the package Chris! I finally managed to get the authentication working but am now getting an error. Here is my code, followed by the error:
here is the request body that the above code generates using this library:
body: '<?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:tns="https://adwords.google.com/api/adwords/cm/v201809" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"><soap:Header><ns1:RequestHeader xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201809" xmlns="https://adwords.google.com/api/adwords/cm/v201809"><ns1:developerToken>adfadadffadf</ns1:developerToken><ns1:userAgent>Sightly</ns1:userAgent><ns1:validateOnly>false</ns1:validateOnly><ns1:clientCustomerId>111-111-1111</ns1:clientCustomerId></ns1:RequestHeader></soap:Header><soap:Body><get xmlns="https://adwords.google.com/api/adwords/cm/v201809"><query>SELECT Id, Name</query></get></soap:Body></soap:Envelope>'
and finally the error I am getting when I call this is below:
toJSON: [Function: responseToJSON],
caseless: Caseless { dict: [Object] },
body:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>Unmarshalling Error: cvc-complex-type.2.4.a: Invalid content was found starting with element '{"https://adwords.google.com/api/adwords/cm/v201809":query}'. One of '{"https://adwords.google.com/api/adwords/cm/v201809":serviceSelector}' is expected. </faultstring></soap:Fault></soap:Body></soap:Envelope>
},
body:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>Unmarshalling Error: cvc-complex-type.2.4.a: Invalid content was found starting with element '{"https://adwords.google.com/api/adwords/cm/v201809":query}'. One of '{"https://adwords.google.com/api/adwords/cm/v201809":serviceSelector}' is expected. </faultstring></soap:Fault></soap:Body></soap:Envelope>
}
Hopefully someone can help. Thank you
The text was updated successfully, but these errors were encountered: