1

I am trying to call bing ads for performance reports. Idea is to print all KPI details of the keywords. Should i require to set any more parameters in the request call? I set all the parameters are explained in the bing document.

        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) {

        } 

When running it throws below exception.

    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)
CrazyProgrammer
  • 544
  • 8
  • 29

1 Answers1

0

For starters you'll need to specify the required elements in the GetHistoricalKeywordPerformance request i.e. Keywords, Language, and MatchTypes. If you are still blocked, try using a web traffic capture tool to view the SOAP request and response. For more information please see the troubleshooting guide. I hope this helps!

Eric Urban
  • 582
  • 2
  • 7