I'm trying to run basic report download example from Bing Ads documentation and I managed to modify the example code to download several other report types by changing the get<REPORT_TYPE>ReportRequest()
method.
The one report type that I'm struggling with is budget summary report.
I create the report request like this:
private static ReportRequest getBudgetSummaryReportRequest(){
BudgetSummaryReportRequest report = new BudgetSummaryReportRequest();
report.setFormat(ReportFormat.CSV);
report.setReportName("My Budget Summary Report");
report.setReturnOnlyCompleteData(false);
ArrayOflong accountIds = new ArrayOflong();
accountIds.getLongs().add(authorizationData.getAccountId());
report.setScope(new AccountThroughCampaignReportScope());
report.getScope().setAccountIds(accountIds);
ArrayOfCampaignReportScope c = new ArrayOfCampaignReportScope();
CampaignReportScope cc = new CampaignReportScope();
cc.setAccountId(authorizationData.getAccountId());
cc.setCampaignId(<MY_CAMPAIGN_ID>);
c.getCampaignReportScopes().add(cc);
report.getScope().setCampaigns(c);
report.setTime(new BudgetSummaryReportTime());
report.getTime().setPredefinedTime(BudgetSummaryReportTimePeriod.TODAY);
ArrayOfBudgetSummaryReportColumn budgetSummaryReportColumns = new ArrayOfBudgetSummaryReportColumn();
budgetSummaryReportColumns.getBudgetSummaryReportColumns().add(BudgetSummaryReportColumn.ACCOUNT_ID);
budgetSummaryReportColumns.getBudgetSummaryReportColumns().add(BudgetSummaryReportColumn.CAMPAIGN_ID);
budgetSummaryReportColumns.getBudgetSummaryReportColumns().add(BudgetSummaryReportColumn.DATE);
budgetSummaryReportColumns.getBudgetSummaryReportColumns().add(BudgetSummaryReportColumn.CURRENCY_CODE);
budgetSummaryReportColumns.getBudgetSummaryReportColumns().add(BudgetSummaryReportColumn.MONTHLY_BUDGET);
budgetSummaryReportColumns.getBudgetSummaryReportColumns().add(BudgetSummaryReportColumn.MONTH_TO_DATE_SPEND);
budgetSummaryReportColumns.getBudgetSummaryReportColumns().add(BudgetSummaryReportColumn.DAILY_SPEND);
return report;
}
and then use the ReportRequest
object in the main method (see reportRequest
field in the example). But no matter what I do, when I try to run it I always get following error:
java.util.concurrent.ExecutionException: com.microsoft.bingads.reporting.CouldNotSubmitReportingDownloadException: java.util.concurrent.ExecutionException: com.microsoft.bingads.reporting.ApiFaultDetail_Exception: Invalid client data. Check the SOAP fault details for more information
at com.microsoft.bingads.internal.ResultFuture.get(ResultFuture.java:96)
at ads.ReportRequests.backgroundCompletion(ReportRequests.java:172)
at ads.ReportRequests.main(ReportRequests.java:90)
Caused by: com.microsoft.bingads.reporting.CouldNotSubmitReportingDownloadException: java.util.concurrent.ExecutionException: com.microsoft.bingads.reporting.ApiFaultDetail_Exception: Invalid client data. Check the SOAP fault details for more information
at com.microsoft.bingads.reporting.ReportingServiceManager$3.handleResponse(ReportingServiceManager.java:216)
at org.apache.cxf.jaxws.JaxwsClientCallback.handleException(JaxwsClientCallback.java:87)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:821)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1638)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:1145)
at org.apache.cxf.workqueue.AutomaticWorkQueueImpl$3.run(AutomaticWorkQueueImpl.java:428)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.cxf.workqueue.AutomaticWorkQueueImpl$AWQThreadFactory$1.run(AutomaticWorkQueueImpl.java:353)
at java.lang.Thread.run(Unknown Source)
Caused by: java.util.concurrent.ExecutionException: com.microsoft.bingads.reporting.ApiFaultDetail_Exception: Invalid client data. Check the SOAP fault details for more information
at org.apache.cxf.jaxws.JaxwsClientCallback$2.get(JaxwsClientCallback.java:99)
at com.microsoft.bingads.reporting.ReportingServiceManager$3.handleResponse(ReportingServiceManager.java:202)
... 9 more
Caused by: com.microsoft.bingads.reporting.ApiFaultDetail_Exception: Invalid client data. Check the SOAP fault details for more information
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.apache.cxf.interceptor.ClientFaultConverter.processFaultDetail(ClientFaultConverter.java:182)
at org.apache.cxf.interceptor.ClientFaultConverter.handleMessage(ClientFaultConverter.java:82)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:113)
at org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor.handleMessage(SOAPHandlerInterceptor.java:140)
at org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor.handleMessage(SOAPHandlerInterceptor.java:71)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:780)
... 7 more
With other report types this error usually meant that I forgot to set some required parameter (e.g. scope). Here I just don't know. How can I debug this problem (e.g. examine this "SOAP data" the error message mentions)?
Does anyone have a working example for budget summary report download?
EDIT: The answer by Eric Urban below solved my problem. Every report request type has some columns that need to be specified manually and added to the ReportRequest object.