call get method of CustomerService (v201506) returns error "Cannot parse response"

300 views
Skip to first unread message

jh...@appannie.com

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

we are calling "get" method of CustomerService (v201506) and get "[Error: Cannot parse response]". Refer to API document https://developers.google.com/adwords/api/docs/reference/v201506/CustomerService I thought we should get errors like "AuthorizationError.USER_PERMISSION_DENIED" or something else.

Could anyone help me with this problem?

thanks,
Jiqin Hong
Appannie.com


Part 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) { ... });
};




And the detail of "err" is

{ [Error: Cannot parse response]
    response:
     { _readableState:
        { highWaterMark: 16384,
          buffer: [],
          length: 0,
          pipes: null,
          pipesCount: 0,
   ......
       read: [Function],
       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' },
    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.

Yin Niu

unread,
Jan 19, 2016, 11:40:07 AM1/19/16
to AdWords API Forum
Hello, 

AdWords API is a SOAP-based WebService. SOAP requests use HTTP POST method.  

Thanks,
Yin, AdWords API Team. 
Reply all
Reply to author
Forward
0 new messages