2

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.

grepe
  • 1,897
  • 2
  • 14
  • 24

1 Answers1

2

A couple of updates should resolve this issue. First, you need to add the missing required columns. The required columns are documented for each value set in the core services reference guide e.g. please see BudgetSummaryReportColumn Value Set. Second, you need to add the columns array to the report request.

budgetSummaryReportColumns.getBudgetSummaryReportColumns().add(BudgetSummaryReportColumn.ACCOUNT_NAME);
budgetSummaryReportColumns.getBudgetSummaryReportColumns().add(BudgetSummaryReportColumn.ACCOUNT_NUMBER);
budgetSummaryReportColumns.getBudgetSummaryReportColumns().add(BudgetSummaryReportColumn.CAMPAIGN_NAME);
report.setColumns(budgetSummaryReportColumns);

For more information about how to capture the SOAP request and response please see Troubleshooting Bing Ads Java SDK. For example I am currently using Spring Framework and Apache CXF.

I hope this helps!

Eric Urban
  • 582
  • 2
  • 7
  • Thank you, I did not realize that I must include the required columns manually. Nevertheless, adding the columns did not solve the problem and I get still the same error. I'll give a try to capturing the SOAP traffic, but I really don't know what I should expect from that... – grepe Dec 15 '16 at 17:53
  • I found I was adding a wrong array of columns after all... thank you again and sorry for a bit emotional formulation of the question. – grepe Dec 16 '16 at 10:30
  • Glad to hear the issue is resolved! This is great feedback and we will take another look at how to make the SDK easier to use, and how to make the troubleshooting guide more discoverable. Please reach out if you have any follow up questions. – Eric Urban Dec 17 '16 at 14:18
  • well, in the code above i use 10 lines of code where i create and/or use 5 different object types and do 17 separate method or constructor calls, just to specify which campaign I want. maybe i'm missing something here again, but perhaps we could do this with a single setCampaign() call? – grepe Dec 19 '16 at 15:28