Monday, 18 January 2016

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

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 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/522711ed-ef45-4b17-ad8b-5ae9ba05f6f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment