[cl-soap-cvs] CVS update: cl-soap/test/test-google-adwords.lisp cl-soap/test/test-xsd.lisp

Sven Van Caekenberghe scaekenberghe at common-lisp.net
Fri Sep 30 17:12:22 UTC 2005


Update of /project/cl-soap/cvsroot/cl-soap/test
In directory common-lisp.net:/tmp/cvs-serv30515/test

Modified Files:
	test-google-adwords.lisp test-xsd.lisp 
Log Message:
first version of xsd bind-element/resolve-element based on the new concept of 'xsd templates' - so far input/output symmetry has been reached and initial testing looks good; awaits further/more/deeper testing and some more cleanup/integration

Date: Fri Sep 30 19:12:21 2005
Author: scaekenberghe

Index: cl-soap/test/test-google-adwords.lisp
diff -u cl-soap/test/test-google-adwords.lisp:1.12 cl-soap/test/test-google-adwords.lisp:1.13
--- cl-soap/test/test-google-adwords.lisp:1.12	Wed Sep 28 11:26:11 2005
+++ cl-soap/test/test-google-adwords.lisp	Fri Sep 30 19:12:20 2005
@@ -1,6 +1,6 @@
 ;;;; -*- mode: lisp -*-
 ;;;;
-;;;; $Id: test-google-adwords.lisp,v 1.12 2005/09/28 09:26:11 scaekenberghe Exp $
+;;;; $Id: test-google-adwords.lisp,v 1.13 2005/09/30 17:12:20 scaekenberghe Exp $
 ;;;;
 ;;;; Some tests on the Google AdWords API (not publically available)
 ;;;;
@@ -19,14 +19,6 @@
 
 (defpackage :google
   (:nicknames "google")
-  (:export 
-   ;; headers
-   "email" "password" "useragent" "token" "clientEmail"
-   ;; info service
-   "getUsageQuotaThisMonth" "getUsageQuotaThisMonthResponse" "getUsageQuotaThisMonthReturn"
-   "getCampaigns" "getCampaign" "getBillingAddress"
-   ;; optionally add more exports, but this is not really needed for wsdl-soap-call's
-   )
   (:documentation "Package for symbols in the Google Adwords API XML Namespace"))
 
 (defparameter *google-adwords-ns* (s-xml:register-namespace +google-adwords-ns-uri+ "google" :google))
@@ -74,154 +66,46 @@
 
 ;;; some test calls
 
-#+NIL
-(defun get-usage-quota-this-month ()
-  (multiple-value-bind (result headers)
-      (soap-call (make-soap-end-point "https://adwords.google.com:443/api/adwords/v2/InfoService")
-                 `((google:|email| ,*google-adwords-email*)
-                   (google:|password| ,*google-adwords-password*)
-                   (google:|useragent| ,*google-adwords-user-agent*)
-                   (google:|token| ,*google-adwords-token*))
-                 `(google:|getUsageQuotaThisMonth|)
-                 :envelope-attributes `(:|xmlns| ,+google-adwords-ns-uri+))
-    (if (eql (lxml-get-tag result) 'google:|getUsageQuotaThisMonthResponse|)
-        (let ((contents (lxml-find-tag 'google:|getUsageQuotaThisMonthReturn| (rest result))))
-          (if contents
-              (values (parse-integer (second contents)) headers)
-            (error "Expected a <getUsageQuotaThisMonthReturn> element")))
-      (error "Expected a <getUsageQuotaThisMonthResponse> element"))))
-  
 (defun get-usage-quota-this-month ()
   (wsdl-soap-call (wsdl-cache-get "https://adwords.google.com:443/api/adwords/v2/InfoService?wsdl")
                   "getUsageQuotaThisMonth"
                   :headers (make-google-headers)))
 
-#+NIL
-(defun get-method-cost (service method &optional (date (ut)))
-  (multiple-value-bind (result headers)
-      (soap-call (make-soap-end-point "https://adwords.google.com:443/api/adwords/v2/InfoService")
-                 `((google:|email| ,*google-adwords-email*)
-                   (google:|password| ,*google-adwords-password*)
-                   (google:|useragent| ,*google-adwords-user-agent*)
-                   (google:|token| ,*google-adwords-token*))
-                 `(google:|getMethodCost| 
-                   (google:|service| ,service)
-                   (google:|method| ,method)
-                   (google:|date| ,(lisp->xsd-date date)))
-                 :envelope-attributes `(:|xmlns| ,+google-adwords-ns-uri+))
-    (if (eql (lxml-get-tag result) 'google:|getMethodCostResponse|)
-        (let ((contents (lxml-find-tag 'google:|getMethodCostReturn| (rest result))))
-          (if contents
-              (values (parse-integer (second contents)) headers)
-            (error "Expected a <getMethodCostReturn> element")))
-      (error "Expected a <getMethodCostResponse> element"))))
-
 (defun get-method-cost (service method &optional (date (ut)))
   (wsdl-soap-call (wsdl-cache-get "https://adwords.google.com:443/api/adwords/v2/InfoService?wsdl")
                   "getMethodCost"
-                  :input `("service" ,service
-                           "method" ,method
-                           "date" ,date)
+                  :input `("getMethodCost" ("service" ,service "method" ,method "date" ,date))
                   :headers (make-google-headers)))
 
-#+NIL
-(defun get-operation-count (start-date &optional (end-date start-date)))
-
 (defun get-unit-count (&optional (start-date (ut)) (end-date start-date))
   (wsdl-soap-call (wsdl-cache-get "https://adwords.google.com:443/api/adwords/v2/InfoService?wsdl")
                   "getUnitCount"
-                  :input `("startDate" ,start-date
-                           "endDate" ,end-date)
+                  :input `("getUnitCount" ("startDate" ,start-date "endDate" ,end-date))
                   :headers (make-google-headers)))
 
-#+NIL
-(defun get-unit-count-for-method (service method &optional (start-date (ut)) (end-date start-date)))
- 
-#+NIL
-(defun get-billing-address (client-email)
-  (multiple-value-bind (result headers)
-      (soap-call (make-soap-end-point "https://adwords.google.com:443/api/adwords/v2/AccountService")
-                 `((google:|email| ,*google-adwords-email*)
-                   (google:|password| ,*google-adwords-password*)
-                   (google:|useragent| ,*google-adwords-user-agent*)
-                   (google:|token| ,*google-adwords-token*)
-                   (google:|clientEmail| ,client-email))
-                 `(google:|getBillingAddress|)
-                 :envelope-attributes `(:|xmlns| ,+google-adwords-ns-uri+))
-    (if (eql (lxml-get-tag result) 'google:|getBillingAddressResponse|)
-        (values (rest result) headers)
-      (error "Expected a <getBillingAddressResponse> element"))))
-
-#+NIL
-(defun get-all-adwords-campaigns (client-email)
-  (multiple-value-bind (result headers)
-      (soap-call (make-soap-end-point "https://adwords.google.com:443/api/adwords/v2/CampaignService")
-                 `((google:|email| ,*google-adwords-email*)
-                   (google:|password| ,*google-adwords-password*)
-                   (google:|useragent| ,*google-adwords-user-agent*)
-                   (google:|token| ,*google-adwords-token*)
-                   (google:|clientEmail| ,client-email))
-                 `(google:|getAllAdWordsCampaigns|
-                   (google:|dummy| "1"))
-                 :envelope-attributes `(:|xmlns| ,+google-adwords-ns-uri+))
-    (values result headers)))
-
 (defun get-all-adwords-campaigns (&optional (client-email *google-client-email*))
   (wsdl-soap-call (wsdl-cache-get "https://adwords.google.com:443/api/adwords/v2/CampaignService?wsdl")
                   "getAllAdWordsCampaigns"
-                  :input '("dummy" 1)
+                  :input '("getAllAdWordsCampaigns" ("dummy" 1))
                   :headers (make-google-headers :client-email client-email)))
 
-#+NIL
-(defun get-campaign (id client-email)
-  (multiple-value-bind (result headers)
-      (soap-call (make-soap-end-point "https://adwords.google.com:443/api/adwords/v2/CampaignService")
-                 `((google:|email| ,*google-adwords-email*)
-                   (google:|password| ,*google-adwords-password*)
-                   (google:|useragent| ,*google-adwords-user-agent*)
-                   (google:|token| ,*google-adwords-token*)
-                   (google:|clientEmail| ,client-email))
-                 `(google:|getCampaign|
-                   (google:|id| ,(princ-to-string id)))
-                 :envelope-attributes `(:|xmlns| ,+google-adwords-ns-uri+))
-    (values result headers)))
-
-#+NIL
-(defun estimate-keyword-list (keywords)
-  "((<text> <type> <max-cpc>)*) where type is Broad|Phrase|Exact"
-  (multiple-value-bind (result headers)
-      (soap-call (make-soap-end-point "https://adwords.google.com:443/api/adwords/v2/TrafficEstimatorService")
-                 `((google:|email| ,*google-adwords-email*)
-                   (google:|password| ,*google-adwords-password*)
-                   (google:|useragent| ,*google-adwords-user-agent*)
-                   (google:|token| ,*google-adwords-token*))
-                 `(google::|estimateKeywordList|
-                   ,@(mapcar #'(lambda (keyword)
-                                 (destructuring-bind (text type max-cpc)
-                                     keyword
-                                   `(google::|keywordRequest|
-                                     (google::|text| ,text)
-                                     (google::|type| ,type)
-                                     (google::|maxCpc| ,max-cpc))))
-                             keywords))
-                 :envelope-attributes `(:|xmlns| ,+google-adwords-ns-uri+))
-    (values result headers)))
-
 (defun estimate-keyword-list (keywords)
   "((<text> <type> <max-cpc>)*) where type is Broad|Phrase|Exact"
   (wsdl-soap-call (wsdl-cache-get "https://adwords.google.com:443/api/adwords/v2/TrafficEstimatorService?wsdl")
                   "estimateKeywordList"
-                  :input (mapcar #'(lambda (keyword)
-                                     (destructuring-bind (text type max-cpc)
-                                         keyword
-                                       `("KeywordRequest" ("text" ,text "type" ,type "maxCpc" ,max-cpc))))
-                                 keywords)
+                  :input `("estimateKeywordList"
+                           ("keywordRequests"
+                            ,(mapcar #'(lambda (keyword)
+                                         (destructuring-bind (text type max-cpc)
+                                             keyword
+                                           `("text" ,text "type" ,type "maxCpc" ,max-cpc)))
+                                     keywords)))
                   :headers (make-google-headers)))
 
 (defun get-all-adgroups (campaign-id)
   (wsdl-soap-call (wsdl-cache-get "https://adwords.google.com:443/api/adwords/v2/AdGroupService?wsdl")
                   "getAllAdGroups"
-                  :input `("campaignID" ,campaign-id)
+                  :input `("getAllAdGroups" ("campaignID" ,campaign-id))
                   :headers (make-google-headers)))
 
 (defun add-campaign (client-email daily-budget status &key name language-targeting geo-targeting)
@@ -256,7 +140,23 @@
   (wsdl-soap-call (wsdl-cache-get "https://adwords.google.com:443/api/adwords/v2/AdGroupService?wsdl")
                   "addAdGroup"
                   :input
-                  `("campaignID" ,campaign-id "AdGroup" ,new-data)
+                  `("addAdGroup" ("campaignID" ,campaign-id "newData" ,new-data))
+                  :headers
+                  (make-google-headers)))
+
+(defun update-ad-group (changed-data)
+  (wsdl-soap-call (wsdl-cache-get "https://adwords.google.com:443/api/adwords/v2/AdGroupService?wsdl")
+                  "updateAdGroup"
+                  :input
+                  `("updateAdGroup" ("changedData" ,changed-data))
+                  :headers
+                  (make-google-headers)))
+
+(defun get-ad-group (id)
+  (wsdl-soap-call (wsdl-cache-get "https://adwords.google.com:443/api/adwords/v2/AdGroupService?wsdl")
+                  "getAdGroup"
+                  :input
+                  `("getAdGroup" ("adGroupId" ,id))
                   :headers
                   (make-google-headers)))
 


Index: cl-soap/test/test-xsd.lisp
diff -u cl-soap/test/test-xsd.lisp:1.1 cl-soap/test/test-xsd.lisp:1.2
--- cl-soap/test/test-xsd.lisp:1.1	Tue Sep 27 18:25:18 2005
+++ cl-soap/test/test-xsd.lisp	Fri Sep 30 19:12:20 2005
@@ -1,6 +1,6 @@
 ;;;; -*- mode: lisp -*-
 ;;;;
-;;;; $Id: test-xsd.lisp,v 1.1 2005/09/27 16:25:18 scaekenberghe Exp $
+;;;; $Id: test-xsd.lisp,v 1.2 2005/09/30 17:12:20 scaekenberghe Exp $
 ;;;;
 ;;;; Some (internal) test on the implementatin of the XML Schema Definition
 ;;;;
@@ -11,9 +11,10 @@
 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
 ;;;;
 
+(in-package :cl-soap)
+
 (let ((schema (get-xml-schema-definition 
                (wsdl-cache-get "https://adwords.google.com:443/api/adwords/v2/CampaignService?wsdl")))
-      (namespace (s-xml:find-namespace "https://adwords.google.com/api/adwords/v2"))
       (lxml '((GOOGLE::|getAllAdWordsCampaignsResponse| :|xmlns| "https://adwords.google.com/api/adwords/v2")
               (GOOGLE::|getAllAdWordsCampaignsReturn|
                (GOOGLE::|dailyBudget| "200000000")
@@ -36,59 +37,14 @@
                (GOOGLE::|optInSearchNetwork| "true")
                (GOOGLE::|optInContentNetwork| "true")
                (GOOGLE::|languageTargeting| (GOOGLE::|languages| "en"))
-               (GOOGLE::|geoTargeting| (GOOGLE::|countries| "AU")))
-              (GOOGLE::|getAllAdWordsCampaignsReturn|
-               (GOOGLE::|dailyBudget| "10000")
-               (GOOGLE::|id| "5614005")
-               (GOOGLE::|name| "Campaign #4")
-               (GOOGLE::|status| "Deleted")
-               (GOOGLE::|startDate| "2005-09-14T07:24:05.000Z")
-               (GOOGLE::|endDate| "2005-09-14T07:24:52.000Z")
-               (GOOGLE::|optInSearchNetwork| "false")
-               (GOOGLE::|optInContentNetwork| "false")
-               ((GOOGLE::|languageTargeting| XSI:|null| "true"))
-               ((GOOGLE::|geoTargeting| XSI:|null| "true")))
-              (GOOGLE::|getAllAdWordsCampaignsReturn|
-               (GOOGLE::|dailyBudget| "10000")
-               (GOOGLE::|id| "5614035")
-               (GOOGLE::|name| "Campaign #5")
-               (GOOGLE::|status| "Deleted")
-               (GOOGLE::|startDate| "2005-09-14T07:30:44.000Z")
-               (GOOGLE::|endDate| "2005-09-14T07:34:13.000Z")
-               (GOOGLE::|optInSearchNetwork| "false")
-               (GOOGLE::|optInContentNetwork| "false")
-               ((GOOGLE::|languageTargeting| XSI:|null| "true"))
-               ((GOOGLE::|geoTargeting| XSI:|null| "true")))
-              (GOOGLE::|getAllAdWordsCampaignsReturn|
-               (GOOGLE::|dailyBudget| "10000")
-               (GOOGLE::|id| "5628855")
-               (GOOGLE::|name| "Campaign #6")
-               (GOOGLE::|status| "Deleted")
-               (GOOGLE::|startDate| "2005-09-16T05:42:20.000Z")
-               (GOOGLE::|endDate| "2005-09-16T05:43:24.000Z")
-               (GOOGLE::|optInSearchNetwork| "false")
-               (GOOGLE::|optInContentNetwork| "false")
-               ((GOOGLE::|languageTargeting| XSI:|null| "true"))
-               ((GOOGLE::|geoTargeting| XSI:|null| "true")))
-              (GOOGLE::|getAllAdWordsCampaignsReturn|
-               (GOOGLE::|dailyBudget| "10000")
-               (GOOGLE::|id| "5634135")
-               (GOOGLE::|name| "Campaign #7")
-               (GOOGLE::|status| "Deleted")
-               (GOOGLE::|startDate| "2005-09-16T20:06:15.000Z")
-               (GOOGLE::|endDate| "2005-09-16T20:22:51.000Z")
-               (GOOGLE::|optInSearchNetwork| "false")
-               (GOOGLE::|optInContentNetwork| "false")
-               ((GOOGLE::|languageTargeting| XSI:|null| "true"))
-               ((GOOGLE::|geoTargeting| XSI:|null| "true"))))))              
+               (GOOGLE::|geoTargeting| (GOOGLE::|countries| "AU"))))))              
   (pprint (resolve-element "getAllAdWordsCampaignsResponse" 
                            lxml 
                            schema
-                           namespace)))
+                           *google-adwords-ns*)))
 
 (let ((schema (get-xml-schema-definition 
                (wsdl-cache-get "https://adwords.google.com:443/api/adwords/v2/AdGroupService?wsdl")))
-      (namespace (s-xml:find-namespace "https://adwords.google.com/api/adwords/v2"))
       (lxml '((GOOGLE::|getAllAdGroupsResponse| :|xmlns| "https://adwords.google.com/api/adwords/v2")
               (GOOGLE::|getAllAdGroupsReturn|
                (GOOGLE::|maxCpc| "8000000")
@@ -127,324 +83,6 @@
                (GOOGLE::|campaignId| "3871365")
                (GOOGLE::|status| "Deleted"))
               (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "90000")
-               (GOOGLE::|name| "Lifestyle Financial Planning")
-               (GOOGLE::|id| "200452095")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Deleted"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "90000")
-               (GOOGLE::|name| "Multi-Manager Investments")
-               (GOOGLE::|id| "200452125")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Deleted"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "12200000")
-               (GOOGLE::|name| "Planning Retirement")
-               (GOOGLE::|id| "200452215")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Deleted"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "90000")
-               (GOOGLE::|name| "Planning my Investments")
-               (GOOGLE::|id| "200452245")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Deleted"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "90000")
-               (GOOGLE::|name| "Reasonable Benefit Limit")
-               (GOOGLE::|id| "200452275")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Deleted"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "6560000")
-               (GOOGLE::|name| "Redundancy Advice")
-               (GOOGLE::|id| "200452305")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Deleted"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "5390000")
-               (GOOGLE::|name| "Retirement Advice")
-               (GOOGLE::|id| "200452335")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Deleted"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "90000")
-               (GOOGLE::|name| "Retrenchment Advice")
-               (GOOGLE::|id| "200452365")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Deleted"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "1610000")
-               (GOOGLE::|name| "Salary Sacrifice")
-               (GOOGLE::|id| "200452395")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "3570000")
-               (GOOGLE::|name| "Superannuation")
-               (GOOGLE::|id| "200452485")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Deleted"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "90000")
-               (GOOGLE::|name| "Superannuation Surcharge")
-               (GOOGLE::|id| "200452515")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Deleted"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "33240000")
-               (GOOGLE::|name| "Tax Advice")
-               (GOOGLE::|id| "200452575")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Deleted"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "7520000")
-               (GOOGLE::|name| "Tax Planning")
-               (GOOGLE::|id| "200452635")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Deleted"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "26910000")
-               (GOOGLE::|name| "Financial Advisor")
-               (GOOGLE::|id| "200452665")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Deleted"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "12980000")
-               (GOOGLE::|name| "Financial Planner")
-               (GOOGLE::|id| "200452695")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Deleted"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "1290000")
-               (GOOGLE::|name| "Tax Tips")
-               (GOOGLE::|id| "200902695")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "5510000")
-               (GOOGLE::|name| "Financial Assistance")
-               (GOOGLE::|id| "200902815")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Deleted"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "43750000")
-               (GOOGLE::|name| "Independent Financial Advisor")
-               (GOOGLE::|id| "200902845")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Deleted"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "2930000")
-               (GOOGLE::|name| "tax information")
-               (GOOGLE::|id| "200902875")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Deleted"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "3660000")
-               (GOOGLE::|name| "Planners")
-               (GOOGLE::|id| "200902905")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Deleted"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "4020000")
-               (GOOGLE::|name| "planning")
-               (GOOGLE::|id| "200902935")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "500000")
-               (GOOGLE::|name| "Australian Financial Planning")
-               (GOOGLE::|id| "200902995")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Deleted"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "8040000")
-               (GOOGLE::|name| "1. Financial Planning (new)")
-               (GOOGLE::|id| "202802655")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "90000")
-               (GOOGLE::|name| "1. Retrenchment Advice (new)")
-               (GOOGLE::|id| "202802715")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "6540000")
-               (GOOGLE::|name| "1. Redundancy Advice (new)")
-               (GOOGLE::|id| "202802775")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "90000")
-               (GOOGLE::|name| "1. Investing Super (new)")
-               (GOOGLE::|id| "202802805")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "90000")
-               (GOOGLE::|name| "1. Super (new)")
-               (GOOGLE::|id| "202802865")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "90000")
-               (GOOGLE::|name| "Lifestyle Financial Planning (new)")
-               (GOOGLE::|id| "202802895")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "90000")
-               (GOOGLE::|name| "Multi-Manager Investments (new)")
-               (GOOGLE::|id| "202802955")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "5370000")
-               (GOOGLE::|name| "1. Retirement Advice (new)")
-               (GOOGLE::|id| "202803075")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "90000")
-               (GOOGLE::|name| "1. Planning my Investments (new)")
-               (GOOGLE::|id| "202803135")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "10520000")
-               (GOOGLE::|name| "Investment Advice (new)")
-               (GOOGLE::|id| "202803165")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "90000")
-               (GOOGLE::|name| "1. Investment Guidance (new)")
-               (GOOGLE::|id| "202803225")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "5500000")
-               (GOOGLE::|name| "1. Financial Assistance (new)")
-               (GOOGLE::|id| "202803285")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "3230000")
-               (GOOGLE::|name| "1. Career Transition (new)")
-               (GOOGLE::|id| "202803315")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "90000")
-               (GOOGLE::|name| "1. Planning Seminars (new)")
-               (GOOGLE::|id| "202803345")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "4600000")
-               (GOOGLE::|name| "1. Financial Tips (new)")
-               (GOOGLE::|id| "202803375")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "2430000")
-               (GOOGLE::|name| "1. Money Tips (new)")
-               (GOOGLE::|id| "202803405")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "200000")
-               (GOOGLE::|name| "1. Super Tips (new)")
-               (GOOGLE::|id| "202803435")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "11750000")
-               (GOOGLE::|name| "1. Investment Tips (new)")
-               (GOOGLE::|id| "202803465")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "4020000")
-               (GOOGLE::|name| "1. planning (new)")
-               (GOOGLE::|id| "202803645")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "90000")
-               (GOOGLE::|name| "1. Reasonable Benefit Limit (new)")
-               (GOOGLE::|id| "202803705")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "90000")
-               (GOOGLE::|name| "1. Superannuation Surcharge (new)")
-               (GOOGLE::|id| "202803735")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "33120000")
-               (GOOGLE::|name| "1. Tax Advice (new)")
-               (GOOGLE::|id| "202803765")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "5420000")
-               (GOOGLE::|name| "1. Financial Plan (new)")
-               (GOOGLE::|id| "202803825")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "3560000")
-               (GOOGLE::|name| "1. Superannuation (new)")
-               (GOOGLE::|id| "202803855")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "3560000")
-               (GOOGLE::|name| "1. Diversified Fund (new)")
-               (GOOGLE::|id| "202803885")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "26820000")
-               (GOOGLE::|name| "1. Financial Advisor (new)")
-               (GOOGLE::|id| "202803915")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "150000")
-               (GOOGLE::|name| "ETP (new)")
-               (GOOGLE::|id| "202803945")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "7490000")
-               (GOOGLE::|name| "1. Tax Planning (new)")
-               (GOOGLE::|id| "202803975")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "12930000")
-               (GOOGLE::|name| "1. Financial Planner (new)")
-               (GOOGLE::|id| "202804005")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "12160000")
-               (GOOGLE::|name| "Retirement Planning")
-               (GOOGLE::|id| "202804035")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
-               (GOOGLE::|maxCpc| "2930000")
-               (GOOGLE::|name| "1. Tax Information (new)")
-               (GOOGLE::|id| "202804095")
-               (GOOGLE::|campaignId| "3871365")
-               (GOOGLE::|status| "Enabled"))
-              (GOOGLE::|getAllAdGroupsReturn|
                (GOOGLE::|maxCpc| "43730000")
                (GOOGLE::|name| "1.Independent Financial Advisor (new)")
                (GOOGLE::|id| "202804125")
@@ -453,6 +91,111 @@
   (pprint (resolve-element "getAllAdGroupsResponse"
                            lxml
                            schema
-                           namespace)))
+                           *google-adwords-ns*)))
+
+(let ((schema (get-xml-schema-definition 
+               (wsdl-cache-get "https://adwords.google.com:443/api/adwords/v2/CampaignService?wsdl")))
+      (lxml '((GOOGLE:|getAllAdWordsCampaignsResponse| :|xmlns| "https://adwords.google.com/api/adwords/v2")
+              (GOOGLE:|getAllAdWordsCampaignsReturn|
+               (GOOGLE:|dailyBudget| "1000000")
+               (GOOGLE:|id| "5631435")
+               (GOOGLE:|name| "Campaign #1")
+               (GOOGLE:|status| "Active")
+               (GOOGLE:|startDate| "2005-09-16T11:11:14.000Z")
+               (GOOGLE:|endDate| "2011-01-01T07:59:59.000Z")
+               (GOOGLE:|optInSearchNetwork| "true")
+               (GOOGLE:|optInContentNetwork| "true")
+               (GOOGLE:|languageTargeting| (GOOGLE:|languages| "en") (GOOGLE:|languages| "nl"))
+               (GOOGLE:|geoTargeting| (GOOGLE:|countries| "BE") (GOOGLE:|countries| "NL"))))))
+  (pprint (resolve-element "getAllAdWordsCampaignsResponse"
+                           lxml
+                           schema
+                           *google-adwords-ns*)))
+
+(let ((schema (get-xml-schema-definition 
+               (wsdl-cache-get "https://adwords.google.com:443/api/adwords/v2/CampaignService?wsdl")))
+      (binding '("id"
+                 5631435
+                 "name"
+                 "Campaign #1"
+                 "status"
+                 "Active"
+                 "startDate"
+                 3335857874
+                 "endDate"
+                 3502857599
+                 "dailyBudget"
+                 1000000
+                 "optInSearchNetwork"
+                 T
+                 "optInContentNetwork"
+                 T
+                 "languageTargeting"
+                 (("languages" "en") ("languages" "nl"))
+                 "geoTargeting"
+                 (("countries" "BE") ("countries" "NL")))))
+  (pprint (bind-type "Campaign"
+                     binding
+                     nil
+                     schema
+                     *google-adwords-ns*)))
+
+(let ((schema (get-xml-schema-definition 
+               (wsdl-cache-get"https://adwords.google.com:443/api/adwords/v2/TrafficEstimatorService?wsdl")))
+      (binding `("estimateKeywordList"
+                 ("keywordRequests"
+                  ,(mapcar #'(lambda (keyword)
+                               (destructuring-bind (text type max-cpc)
+                                   keyword
+                                 `("text" ,text "type" ,type "maxCpc" ,max-cpc)))
+                           '(("flowers" "Broad" 50000) ("tree" "Broad" 100000)))))))
+  (pprint (bind-element "estimateKeywordList"
+                        binding
+                        schema
+                        *google-adwords-ns*)))
+
+(let ((schema (get-xml-schema-definition 
+               (wsdl-cache-get"https://adwords.google.com:443/api/adwords/v2/TrafficEstimatorService?wsdl")))
+      (binding '("text" "flowers" "type" "Broad" "maxCpc" 50000)))
+  (pprint (bind-type "KeywordRequest"
+                     binding
+                     nil
+                     schema
+                     *google-adwords-ns*)))
+
+(defun test-1 ()
+  (let* ((schema (get-xml-schema-definition 
+                  (wsdl-cache-get "https://adwords.google.com:443/api/adwords/v2/TrafficEstimatorService?wsdl")))
+         (template (generate-xsd-template "estimateKeywordList" schema))
+         (binding `("estimateKeywordList"
+                    ("keywordRequests"
+                     ,(mapcar #'(lambda (keyword)
+                                  (destructuring-bind (text type max-cpc)
+                                      keyword
+                                    `("text" ,text "type" ,type "maxCpc" ,max-cpc)))
+                              '(("flowers" "Broad" 50000) ("tree" "Broad" 100000)))))))
+    (bind-xsd-template template
+                       binding
+                       *google-adwords-ns*)))
+
+(defun test-2 ()
+  (let* ((schema (get-xml-schema-definition 
+                  (wsdl-cache-get "https://adwords.google.com:443/api/adwords/v2/CampaignService?wsdl")))
+         (template (generate-xsd-template "getAllAdWordsCampaignsResponse" schema))
+         (lxml '((GOOGLE::|getAllAdWordsCampaignsResponse| :|xmlns| "https://adwords.google.com/api/adwords/v2")
+                 (GOOGLE::|getAllAdWordsCampaignsReturn|
+                  (GOOGLE::|dailyBudget| "1000000")
+                  (GOOGLE::|id| "5631435")
+                  (GOOGLE::|name| "Campaign #1")
+                  (GOOGLE::|status| "Active")
+                  (GOOGLE::|startDate| "2005-09-16T11:11:14.000Z")
+                  (GOOGLE::|endDate| "2011-01-01T07:59:59.000Z")
+                  (GOOGLE::|optInSearchNetwork| "true")
+                  (GOOGLE::|optInContentNetwork| "true")
+                  (GOOGLE::|languageTargeting| (GOOGLE::|languages| "en") (GOOGLE::|languages| "nl"))
+                  (GOOGLE::|geoTargeting| (GOOGLE::|countries| "BE") (GOOGLE::|countries| "NL"))))))
+    (resolve-xsd-template template
+                          (list lxml)
+                          *google-adwords-ns*)))
 
 ;;;; eof




More information about the Cl-soap-cvs mailing list