Hello Archia, It looks like you're getting this error because you're trying to pass in a serialized array for the value of the <campaignIds> XML element. <campaignIds> should take exactly one number as its value, and if you want to get stats for multiple campaigns, you'd create multiple <campaignIds> elements.
That being said, the approach of trying to modify the sample code to fit a different API method probably isn't the easiest way to go about things. If you're developing using PHP, have you thought about using the APIlity client library? It takes care of the XML creation for you. http://google-apility.sourceforge.net/ Cheers, -Jeff Posnick, AdWords API Team On Dec 29, 1:52 pm, Archia <[email protected]> wrote: > OK, I substituted fake values for my login email, pass, client email, > and useragent. > > POST /api/adwords/v12/CampaignService HTTP/1.0 Host: > adwords.google.com User-Agent: NuSOAP/0.7.3 (1.114) Content-Type: text/ > xml; charset=ISO-8859-1 SOAPAction: "" Content-Length: 808 > [email protected] > TVu9sAo6Sjw07BBjAZCGYNKXOee45ohO6jBO_kQArray2008-01-01T00:00:00Z2008-12-01T00:00:00ZHTTP/ > 1.1 500 Internal Server Error Content-Type: text/xml; > charset=iso-8859-1 Transfer-Encoding: chunked Date: Mon, 29 Dec 2008 > 18:45:42 GMT X-Content-Type-Options: nosniff Expires: Mon, 29 Dec 2008 > 18:45:42 GMT Cache-Control: private, max-age=0 Server: GFE/1.3 > Connection: Close 424 0 0 427fa66c6d5a5dddd4bf94cfdfe81983 > soapenv:Server.userException java.lang.NumberFormatException: For > input string: "Array" java.lang.NumberFormatException: For input > string: "Array" at java.lang.NumberFormatException.forInputString > (Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at > java.lang.Integer.<init>(Unknown Source) at > sun.reflect.GeneratedConstructorAccessor49.newInstance(Unknown Source) > at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown > Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) > at org.apache.axis.encoding.ser.SimpleDeserializer.makeValue > (SimpleDeserializer.java:276) at > org.apache.axis.encoding.ser.SimpleDeserializer.onEndElement > (SimpleDeserializer.java:176) at > org.apache.axis.encoding.DeserializerImpl.endElement > (DeserializerImpl.java:508) at > org.apache.axis.encoding.DeserializationContext.endElement > (DeserializationContext.java:1077) at > org.apache.axis.message.SAX2EventRecorder.replay > (SAX2EventRecorder.java:165) at > org.apache.axis.message.MessageElement.publishToHandler > (MessageElement.java:1138) at > org.apache.axis.message.RPCElement.deserialize(RPCElement.java:199) at > org.apache.axis.message.RPCElement.getParams(RPCElement.java:342) at > org.apache.axis.providers.java.RPCProvider.processMessage > (RPCProvider.java:146) at > com.google.ads.netapi.config.AdWordsApiProvider.processMessage > (AdWordsApiProvider.java:62) at > org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java: > 319) at org.apache.axis.strategies.InvocationStrategy.visit > (InvocationStrategy.java:32) at org.apache.axis.SimpleChain.doVisiting > (SimpleChain.java:118) at org.apache.axis.SimpleChain.invoke > (SimpleChain.java:83) at > org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:450) > at org.apache.axis.server.AxisServer.invoke(AxisServer.java:285) at > org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java: > 637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) > at org.apache.axis.transport.http.AxisServletBase.service > (AxisServletBase.java:301) at javax.servlet.http.HttpServlet.service > (HttpServlet.java:802) at com.google.gse.FilteredServlet > $ChainEnd.doFilter(FilteredServlet.java:168) at > com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:46) at > com.google.gse.FilteredServlet$Chain.doFilter(FilteredServlet.java: > 146) at com.google.soap.base.LoggingFilter.doFilter(LoggingFilter.java: > 142) at com.google.gse.FilteredServlet$Chain.doFilter > (FilteredServlet.java:146) at > com.google.servlet.balancing.LoadBalancingFilter.processRequestLocally > (LoadBalancingFilter.java:405) at > com.google.servlet.balancing.LoadBalancingFilter.loadBalanceRequest > (LoadBalancingFilter.java:214) at > com.google.servlet.balancing.LoadBalancingFilter.doFilter > (LoadBalancingFilter.java:161) at com.google.gse.FilteredServlet > $Chain.doFilter(FilteredServlet.java:146) at > com.google.gse.FilteredServlet.service(FilteredServlet.java:118) at > com.google.gse.HttpConnection.runServletFromWithinSpan > (HttpConnection.java:768) at com.google.gse.HttpConnection$1.run > (HttpConnection.java:701) at > com.google.tracing.LocalTraceSpanRunnable.run > (LocalTraceSpanRunnable.java:56) at > com.google.tracing.LocalTraceSpanBuilder.run > (LocalTraceSpanBuilder.java:384) at > com.google.gse.HttpConnection.runServlet(HttpConnection.java:694) at > com.google.gse.HttpConnection.run(HttpConnection.java:650) at > com.google.gse.DispatchQueue$WorkerThread.run(DispatchQueue.java:339) > true Fault: 1 Code: soapenv:Server.userException String: > java.lang.NumberFormatException: For input string: "Array" Detail: > > On Dec 29, 1:42 pm, AdWords API Advisor <[email protected]> > wrote: > > > Hello Archia, > > > Could you please post the entire SOAP response XML, including the > > SOAP response headers and the full fault? > > > Cheers, > > -Jeff Posnick, AdWords API Team > > > On Dec 29, 1:39 pm, Archia <[email protected]> wrote: > > > > It is a Production environment by the way. > > > > On Dec 29, 1:28 pm, AdWords API Advisor <[email protected]> > > > wrote: > > > > > Hello Archia, > > > > > We're going to need more information about what error you received in > > > > order to help you. Can you provide the SOAP response with the fault > > > > that you received? > > > > > Looking at your code, I see a syntax error with > > > > > $campaignIds = array(1234567]); > > > > > due to an unneeded ']' character. You also obviously need to make sure > > > > you're passing in a valid campaign ID for the environment you're > > > > talking to--if it's the Sandbox then a campaign that exists in the > > > > Sandbox, and if it's Production then a campaign that exists for that > > > > account in Production. > > > > > Cheers, > > > > -Jeff Posnick, AdWords API Team > > > > > On Dec 29, 1:17 pm, Archia <[email protected]> wrote: > > > > > > Hi, > > > > > > I tried to modify the PHP sample code for get_all_campaigns.php > > > > > (http://code.google.com/p/adwords-api-php-samples/source/browse/trunk/ > > > > > src/get_all_campaigns.php) to retrieve getCampaignStats but only got > > > > > an error. How can I retrieve the StatsRecord[] response for a given > > > > > campaign? > > > > > > Here is the code I used: > > > > > > require_once('soapclientfactory.php'); > > > > > > # Define SOAP headers. > > > > > $headers = $this->define_soap_headers(); //this part works fine - the > > > > > headers are correctly set > > > > > > # Set up service connection. > > > > > > $namespace = 'https://adwords.google.com/api/adwords/v12'; > > > > > $campaign_service = > > > > > SoapClientFactory::GetClient($namespace . '/CampaignService?wsdl', > > > > > 'wsdl'); > > > > > $campaign_service->setHeaders($headers); > > > > > $debug = 0; > > > > > > $campaignIds = array(1234567]); > > > > > > # > > > > > $start = '2008-01-01T00:00:00Z'; > > > > > > # > > > > > $end = '2008-12-01T00:00:00Z'; > > > > > > # > > > > > $request_xml = > > > > > '<getCampaignStats><campaignIds>'.$campaignIds.'</ > > > > > campaignIds><startDay>'.$start.'</startDay><endDay>'.$end.'</endDay></ > > > > > getCampaignStats>'; > > > > > $campaign_stats = $campaign_service->call('getCampaignStats', > > > > > $request_xml); > > > > > $campaign_stats = $campaign_stats['getCampaignStatsReturn']; > > > > > > if ($debug) $this->show_xml($campaign_service); > > > > > if ($campaign_service->fault) $this->show_fault($campaign_service); > > > > > > # Convert to a list if we get back a single object. > > > > > if (!$campaign_stats[0]) { > > > > > $campaign_stats = array($campaign_stats); > > > > > > } > > > > > > print_r($campaign_stats); --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en -~----------~----~----~----~------~----~------~--~---
