Hi, Can you confirm that there are campaigns in that sandbox account? If so, can you post the SOAP XML request and response?
Best, - Eric Koleda, AdWords API Team On Apr 12, 1:33 pm, J <jatinder.k...@gmail.com> wrote: > Hello, > > I am trying to create JAX WS proxy and then connect to sandbox to > download campaigns. However, when i execute my code, there are no > campaigns downloaded -- there are no errors either. Following is my > code snippet: > > campaignService = new CampaignService(); > CampaignServiceInterface campaignServiceInterface = > campaignService.getCampaignServiceInterfacePort(); > // Add your code to call the desired methods. > try { > String email = "<email>"; > String password = "<password>"; > String clientEmail = "<client email>"; > String userAgent = "AdWords API Java Code Example"; > String developerToken = "something"; > String applicationToken = "something"; > boolean validateOnly = false; > > // Create authToken. > String authToken = new AuthToken(email, password).getAuthToken(); > System.out.println("auth: " + authToken); > > // Set SOAP and XML settings. To send requests to production > environment, > // replace "adwords-sandbox.google.com" with "adwords.google.com" > in the wsdl > // URL. The namespace will always be "adwords.google.com", even in > the > // sandbox. > String serviceUrl = "https://adwords-sandbox.google.com/api/ > adwords/cm/v200909/CampaignService"; > String namespace = "https://adwords.google.com/api/adwords/cm/ > v200909"; > > ((BindingProvider)campaignServiceInterface).getRequestContext().put(Binding > Provider.ENDPOINT_ADDRESS_PROPERTY, > serviceUrl); > > // Set the header. > SoapHeader soapHeader = new SoapHeader(); > soapHeader.setApplicationToken(applicationToken); > soapHeader.setAuthToken(authToken); > soapHeader.setClientCustomerId(null); > soapHeader.setClientEmail(clientEmail); > soapHeader.setUserAgent(userAgent); > soapHeader.setValidateOnly(validateOnly); > soapHeader.setDeveloperToken(developerToken); > > // ((Stub) campaignService).setHeader(namespace, "RequestHeader", > soapHeader); > > // Create selector. > CampaignSelector selector = new CampaignSelector(); > List<SoapResponseHeader> holderList = new > ArrayList<SoapResponseHeader>(); > SoapResponseHeader header = new SoapResponseHeader(); > javax.xml.ws.Holder<SoapResponseHeader> status = new Holder(); > > // Get all campaigns. > CampaignPage page = campaignServiceInterface.get(selector, > soapHeader, status); > > System.out.println("status is: " + status.value.getRequestId()); > > // Display campaigns. > if (page.getEntries() != null) { > for (Campaign campaign : page.getEntries()) { > System.out.println("Campaign with name \"" + > campaign.getName() + "\" and id \"" > + campaign.getId() + "\" was found."); > } > } else { > System.out.println("No campaigns were found."); > } > } > catch (Exception e) { > e.printStackTrace(); > } > } -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Have you migrated to v200909 yet? The v13 sunset is on April 22, 2010. Also find us on our blog and discussion group: http://adwordsapi.blogspot.com http://groups.google.com/group/adwords-api =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en To unsubscribe, reply using "remove me" as the subject.