Неверные данные клиента в запросе BingAd

Я пытаюсь вызвать объявления Bing для отчетов об эффективности. Идея состоит в том, чтобы напечатать все детали KPI ключевых слов. Должен ли я установить дополнительные параметры в запросе? Я установил все параметры, описанные в документе Bing.

        PasswordAuthentication passwordAuthentication
                = new PasswordAuthentication(USER_NAME, PASSWORD);
        authorizationData.setAuthentication(passwordAuthentication);

        authorizationData.setCustomerId(customerId);
        authorizationData.setAccountId(accountId);
        authorizationData.setDeveloperToken(DEVELOPER_TOKEN);

        ServiceClient<IAdInsightService> adInsightService = new ServiceClient<IAdInsightService>(
                authorizationData,
                IAdInsightService.class);

        GetHistoricalKeywordPerformanceRequest getHistoricalKeywordPerformanceRequest = new GetHistoricalKeywordPerformanceRequest();

        try {
            GetHistoricalKeywordPerformanceResponse historicalKeywordPerformance = adInsightService.getService().getHistoricalKeywordPerformance(getHistoricalKeywordPerformanceRequest);
            ArrayOfKeywordHistoricalPerformance keywordHistoricalPerformances = historicalKeywordPerformance.getKeywordHistoricalPerformances();
            List<KeywordHistoricalPerformance> keywordHistoricalPerformances1 = keywordHistoricalPerformances.getKeywordHistoricalPerformances();
            for (Iterator<KeywordHistoricalPerformance> iterator = keywordHistoricalPerformances1.iterator(); iterator.hasNext();) {
                KeywordHistoricalPerformance performance = iterator.next();
                ArrayOfKeywordKPI keywordKPIs = performance.getKeywordKPIs();
                for (Iterator<KeywordKPI> iterator1 = keywordKPIs.getKeywordKPIs().iterator(); iterator1.hasNext();) {
                    KeywordKPI kPI = iterator1.next();
                    System.out.println("Impressions " + kPI.getImpressions());
                }
            }

        } catch (Exception ex) {

        } 

При запуске он выбрасывает ниже исключения.

    com.microsoft.bingads.v10.adinsight.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(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
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:798)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1638)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1527)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1330)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:638)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:326)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:279)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:138)
at com.sun.proxy.$Proxy59.getHistoricalKeywordPerformance(Unknown Source)
at test.BingApi.main(BingApi.java:88)

1 ответ

Для начала вам нужно указать обязательные элементы в запросе GetHistoricalKeywordPerformance, т.е. ключевые слова, язык и MatchTypes. Если вы все еще заблокированы, попробуйте использовать инструмент захвата веб-трафика для просмотра запроса и ответа SOAP. Для получения дополнительной информации см. Руководство по устранению неполадок. Надеюсь, это поможет!

Другие вопросы по тегам