Bing ads api - InternalServiceFault when calling PollGenerateReport

Juyi Wu 35 Reputation points Microsoft Employee
2023-06-20T07:37:22.6866667+00:00

I submitted generate report request and got a report id, but failed to poll report status using the id.

Here is my SubmitGenerateReport request:

<s:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header xmlns="https://bingads.microsoft.com/Reporting/v13">
    <Action mustUnderstand="1">SubmitGenerateReport</Action>
    <AuthenticationToken i:nil="false">{{accesstoken}}</AuthenticationToken>
    <CustomerAccountId i:nil="false">151032114</CustomerAccountId>
    <CustomerId i:nil="false">162626200</CustomerId>
    <DeveloperToken i:nil="false">{{devtoken}}</DeveloperToken>
  </s:Header>
  <s:Body>
    <SubmitGenerateReportRequest xmlns="https://bingads.microsoft.com/Reporting/v13">
      <ReportRequest i:nil="false" i:type="CampaignPerformanceReportRequest">
        <ExcludeColumnHeaders i:nil="false">false</ExcludeColumnHeaders>
        <ExcludeReportFooter i:nil="false">false</ExcludeReportFooter>
        <ExcludeReportHeader i:nil="false">false</ExcludeReportHeader>
        <Format i:nil="false">Csv</Format>
        <FormatVersion i:nil="false">2.0</FormatVersion>
        <ReportName i:nil="false">0620-01</ReportName>
        <ReturnOnlyCompleteData i:nil="false">false</ReturnOnlyCompleteData>
        <!--These fields are applicable if the derived type attribute is set to CampaignPerformanceReportRequest-->
        <Aggregation>Hourly</Aggregation>
        <Columns i:nil="false">
          <CampaignPerformanceReportColumn>AccountId</CampaignPerformanceReportColumn>
          <CampaignPerformanceReportColumn>AccountName</CampaignPerformanceReportColumn>
          <CampaignPerformanceReportColumn>TimePeriod</CampaignPerformanceReportColumn>
          <CampaignPerformanceReportColumn>CampaignStatus</CampaignPerformanceReportColumn>
          <CampaignPerformanceReportColumn>AdDistribution</CampaignPerformanceReportColumn>
          <CampaignPerformanceReportColumn>CampaignId</CampaignPerformanceReportColumn>
          <CampaignPerformanceReportColumn>Impressions</CampaignPerformanceReportColumn>
          <CampaignPerformanceReportColumn>Spend</CampaignPerformanceReportColumn>
        </Columns>
        <Filter i:nil="false">
        </Filter>
        <Scope i:nil="false">
          <AccountIds i:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <a1:long>151032114</a1:long>
          </AccountIds>
          <Campaigns i:nil="false">
            <CampaignReportScope>
              <AccountId>151032114</AccountId>
              <CampaignId>482431171</CampaignId>
            </CampaignReportScope>
          </Campaigns>
        </Scope>
        <Time i:nil="false">
          <PredefinedTime i:nil="false">Last30Days</PredefinedTime>
          <ReportTimeZone i:nil="false">Taipei</ReportTimeZone>
        </Time>
      </ReportRequest>
    </SubmitGenerateReportRequest>
  </s:Body>
</s:Envelope>

Here is the response:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Header>
        <h:TrackingId xmlns:h="https://bingads.microsoft.com/Reporting/v13">a4d316ab-8287-4b6f-8d7f-5ebb24206ddb</h:TrackingId>
    </s:Header>
    <s:Body>
        <SubmitGenerateReportResponse xmlns="https://bingads.microsoft.com/Reporting/v13">
            <ReportRequestId>1103017703698_1687244179360</ReportRequestId>
        </SubmitGenerateReportResponse>
    </s:Body>
</s:Envelope>

Here is my PollGenerateReport request:

<s:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header xmlns="https://bingads.microsoft.com/Reporting/v13">
    <Action mustUnderstand="1">SubmitGenerateReport</Action>
    <AuthenticationToken i:nil="false">{{accesstoken}}</AuthenticationToken>
    <CustomerAccountId i:nil="false">151032114</CustomerAccountId>
    <CustomerId i:nil="false">162626200</CustomerId>
    <DeveloperToken i:nil="false">{{devtoken}}</DeveloperToken>
  </s:Header>
  <s:Body>
    <PollGenerateReportRequest xmlns="https://bingads.microsoft.com/Reporting/v13">
      <ReportRequestId i:nil="false">1103017703698_1687244179360</ReportRequestId>
    </PollGenerateReportRequest>
  </s:Body>
</s:Envelope>

Here is the response:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <s:Fault>
            <faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:InternalServiceFault</faultcode>
            <faultstring>The server was unable to process the request due to an internal error.  For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the &lt;serviceDebug&gt; configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs.</faultstring>
        </s:Fault>
    </s:Body>
</s:Envelope>

I'm using postman to call ads api. How can I turn on the IncludeExceptionDetailInFaults to see error detail?

Microsoft Advertising API
Microsoft Advertising API
A Microsoft API that provides programmatic access to Microsoft Advertising to manage large campaigns or to integrate your marketing with other in-house systems.
416 questions
0 comments No comments
{count} vote

Accepted answer
  1. Venera Bagramshina 75 Reputation points
    2023-06-29T12:06:55.9333333+00:00

    Hi there,

    As I see, you are passing action SubmitGenerateReport while sending PollGenerateReport. Try to change action:

        <Action mustUnderstand="1">PollGenerateReport</Action>
    
    

    Also, I had same problem when I had incorrect header value. You can try to add header SOAPAction = 'PollGenerateReport':

    User's image

    Btw, now I have problem with ReportDownloadUrl - when I follow it, I'm getting ResourceNotFound error. Maybe, you know how to fix it?

    This XML file does not appear to have any style information associated with it. The document tree is shown below. <Error> <Code>ResourceNotFound</Code> <Message>The specified resource does not exist. RequestId:f3ae3a7f-101e-000e-2581-aa9447000000 Time:2023-06-29T12:05:25.9749412Z</Message> </Error>

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.