Monday, 18 January 2016

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

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 legal@appannie.com immediately and remove it from your system.

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
 
You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups "AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/ed1a2141-827a-4944-91da-c2b870deaf92%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment