难以访问Java库AdwordsService Get Method并在ColdFusion中传入Interface Class。我使用的是ColdFusion 11.
Bundle
有没有ColdFusion和Adwords Java集成的例子?我尝试使用谷歌搜索,但我找不到任何东西。
<cfscript>
variables.File_Obj = createObject("java", "java.io.File");
variables.HTTP_Transport = createObject("java", "com.google.api.client.http.javanet.NetHttpTransport").init();
variables.JSON_Factory = createObject("java", "com.google.api.client.json.jackson2.JacksonFactory").init();
variables.HTTP_Request_Initializer = createObject("java", "com.google.api.client.http.HttpRequestInitializer");
variables.Offline_Credential_Builder = createObject("java", "com.google.api.ads.common.lib.auth.OfflineCredentials$Builder");
variables.API = createObject("java", "com.google.api.ads.common.lib.auth.OfflineCredentials$Api");
variables.adwordsService = createObject("java", "com.google.api.ads.adwords.axis.factory.AdWordsServices").init();
variables.Budget = createObject("java", "com.google.api.ads.adwords.axis.v201506.cm.Budget");
variables.BudgetBudgetDeliveryMethod = createObject("java", "com.google.api.ads.adwords.axis.v201506.cm.BudgetBudgetDeliveryMethod");
variables.BudgetBudgetPeriod = createObject("java", "com.google.api.ads.adwords.axis.v201506.cm.BudgetBudgetPeriod");
BudgetServiceInterface = createObject("java", "com.google.api.ads.adwords.axis.v201509.cm.BudgetServiceInterface");
variables.Money = createObject("java", "com.google.api.ads.adwords.axis.v201506.cm.Money");
variables.adsession_builder = createObject("java", "com.google.api.ads.adwords.lib.client.AdWordsSession$Builder");
oAuth2Credential = Offline_Credential_Builder
.forApi(Api.ADWORDS)
.fromFile(variables.File_Obj.Init(expandPath('ads.properties')))
.build()
.generateCredential();
AdwordsSession = adsession_builder.fromFile(expandPath('ads.properties'))
.withOAuth2Credential(oAuth2Credential)
.build();
BaseServices = createObject("java","com.google.api.ads.common.lib.factory.BaseServices");
budgetService = BaseServices.get(AdwordsSession,BudgetServiceInterface);
writeDump(budgetService);
</cfscript>
的CFDump。
以下是我尝试使用AdwordsService
AdWordsServices