-
Notifications
You must be signed in to change notification settings - Fork 979
Closed
Description
The issue is that the library appears to be deleting the customer entity before generating the outbound soap request as it contains only an empty value for trackingUrlTemplate. The workaround is to also supply the customerId in the payload so the customer entity isn't removed. The customerId (or any other value) should not be necessary for this operation to succeed. This may be related to the issue #62. It was occurring on the latest client library code on Python 2.7 as of 3 days ago.
sample code
from googleads import adwords
from pprint import pprint
import logging
logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.transport').setLevel(logging.DEBUG)
def main(client):
customer_service = client.GetService('CustomerService', version='v201506')
try:
customer = customer_service.mutate({u'trackingUrlTemplate': u'', 'xsi_type': 'Customer'})
#customer = customer_service.mutate({u'trackingUrlTemplate': u'', 'xsi_type': 'Customer', 'customerId': 7894463870}) # this line will work
pprint(customer)
except Exception, exc:
print(exc.document.str())
if __name__ == '__main__':
adwords_client = adwords.AdWordsClient.LoadFromStorage()
main(adwords_client)
soap log without entity
INFO:oauth2client.client:Refreshing access_token
DEBUG:suds.transport.http:opening (https://adwords.google.com/api/adwords/mcm/v201506/CustomerService?wsdl)
DEBUG:suds.transport.http:sending:
URL: https://adwords.google.com/api/adwords/mcm/v201506/CustomerService
HEADERS: {'Soapaction': '""', 'SOAPAction': '""', 'Content-Type': 'text/xml; charset=utf-8', 'Content-type': 'text/xml; charset=utf-8', 'Authorization': u'XXXXXXXXXXXXXXXXXXXXX'}
MESSAGE:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="https://adwords.google.com/api/adwords/mcm/v201506" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="https://adwords.google.com/api/adwords/mcm/v201506" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<tns:RequestHeader>
<tns:clientCustomerId xmlns:tns="https://adwords.google.com/api/adwords/cm/v201506">XXXXXXXX</tns:clientCustomerId>
<tns:developerToken xmlns:tns="https://adwords.google.com/api/adwords/cm/v201506">XXXXXXXXXXXXXXXX</tns:developerToken>
<tns:userAgent xmlns:tns="https://adwords.google.com/api/adwords/cm/v201506">XXXXXXXXXXXXX</tns:userAgent>
<tns:validateOnly xmlns:tns="https://adwords.google.com/api/adwords/cm/v201506">false</tns:validateOnly>
<tns:partialFailure xmlns:tns="https://adwords.google.com/api/adwords/cm/v201506">false</tns:partialFailure>
</tns:RequestHeader>
</SOAP-ENV:Header>
<ns1:Body>
<ns0:mutate/>
</ns1:Body>
</SOAP-ENV:Envelope>
ERROR:suds.client:<suds.sax.document.Document instance at 0x02F0EF08>
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<ResponseHeader xmlns="https://adwords.google.com/api/adwords/mcm/v201506" xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201506">
<ns2:requestId>00051f705a557b190abca28fcb0b0cde</ns2:requestId>
<ns2:serviceName>CustomerService</ns2:serviceName>
<ns2:methodName>mutate</ns2:methodName>
<ns2:operations>0</ns2:operations>
<ns2:responseTime>202</ns2:responseTime>
</ResponseHeader>
</soap:Header>
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>[RequiredError.REQUIRED @ customer]</faultstring>
<detail>
<ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/mcm/v201506" xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201506">
<ns2:message>[RequiredError.REQUIRED @ customer]</ns2:message>
<ns2:ApplicationException.Type>ApiException</ns2:ApplicationException.Type>
<ns2:errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:RequiredError">
<ns2:fieldPath>customer</ns2:fieldPath>
<ns2:trigger/>
<ns2:errorString>RequiredError.REQUIRED</ns2:errorString>
<ns2:ApiError.Type>RequiredError</ns2:ApiError.Type>
<ns2:reason>REQUIRED</ns2:reason>
</ns2:errors>
</ApiExceptionFault>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
Metadata
Metadata
Assignees
Labels
No labels