call get method of adwords CustomerService(v201506) get "[Error: Cannot parse response]"

14 views
Skip to first unread message

jh...@appannie.com

unread,
Jan 19, 2016, 8:59:04 AM1/19/16
to AdWords API Forum
hello,

I am calling "get" method of CustomerService(v201506) and get error like "[Error: Cannot parse response]". I have read the API document https://developers.google.com/adwords/api/docs/reference/v201506/CustomerService and thought we should get errors like AuthenticationError.AUTHENTICATION_FAILED. 

Could someone help me with that?

thanks,


parts of our code:

var soap = require('soap');

var GetAdWordsClient = function GetAdWordsClient(url) {
soap.
createClient(url, function(err, client) {
client.setSecurity(new soap.BearerSecurity(G.accessToken));
var indexLastSlash = url.lastIndexOf('/');
var ns1 = url.substring(0, indexLastSlash);
var requestHeader = {
'developerToken': ...,
'userAgent': ...,
'validateOnly': 'false',
'partialFailure': 'false'
};
client.
addSoapHeader({RequestHeader: requestHeader}, "", "ns1", ns1);
G.client = client;
common.StopWaiting();
});
common.Wait();
return G.client;
};

var GetCustomerClientId = function GetCustomerClientId() {
var url = 'https://adwords.google.com/api/adwords/mcm/v201506/CustomerService?wsdl';
    var client = GetAdWordsClient(url);
client.get({}, function(err, result, raw, soapHeader) {...});
};



Parts of the "err" message:
{ [Error: Cannot parse response]
    response:
     { _readableState:
        { highWaterMark: 16384,
          buffer: [],
          length: 0,
          pipes: null,
   ...
    body: '<HTML>\n<HEAD>\n<TITLE>Unauthorized</TITLE>\n</HEAD>\n<BODY BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>Unauthorized</H1>\n<H2>Error 401</H2>\n</BODY>\n</HTML>\n' }



This email may contain or reference confidential information and is intended only for the individual to whom it is addressed.  Please refrain from distributing, disclosing or copying this email and the information contained within unless you are the intended recipient.  If you received this email in error, please notify us at le...@appannie.com immediately and remove it from your system.
Reply all
Reply to author
Forward
0 new messages