Thanks Jeff, I figured out the problem regarding the client library code earlier.. thanks specially for your valuable clarification on the namespace.
Cheers, Sachin ;o) On Oct 22, 8:38 pm, AdWords API Advisor <[EMAIL PROTECTED]> wrote: > Hello Sachin, > > The code sample you pasted below is not from the Java client library. > It's taken from the sample code that we make available to serve as a > reference implementation and link to from the AdWords API > documentation. > > If you're looking for standalone code that will work both in the > Sandbox and Production environment with minimal changes, please try > the Java client library, available at > > http://code.google.com/p/google-api-adwords-java/ > > To answer your specific question about namespaces, the namespace is > identical (http://adwords.google.com/...) regardless of whether you're > making a request to the Sandbox or Production environments. The only > thing that differs is the URL of the SOAP endpoint that you're > contacting. But if you use the Java client library then you normally > would not have to worry about those details. > > Cheers, > -Jeff Posnick, AdWords API Team > > On Oct 22, 5:44 am, Sachin <[EMAIL PROTECTED]> wrote: > > > I am facing a problem with Sandbox.. calls to the sandbox throws the > > error that \\" The request did not contain a header named 'email. \\". > > I have appended the main program that i m using to make the API calls > > to Sandbox. > > > I m not sure about the "namespace" that i have to use, as while > > debugging i see the adwords namespace "adwords.google.com" hard-coded > > in each of the calls in the source-code, thats provided along-with the > > client library. > > > I suppose these should point to "sandbox.google.com" as i wish to make > > calls to Sandbox. Or is there is some other client library for sandbox > > calls. > > > These are the code samples i found confusing in the source code. > > ----------------------- > > 1. private java.lang.String AccountService_address = "https:// > > adwords.google.com/api/adwords/v12/AccountService"; > > > 2. _call.setOperationName(new javax.xml.namespace.QName("https:// > > adwords.google.com/api/adwords/v12", "getAccountInfo")); > > ------------------------ > > > public class AdwordClient { > > // Provide AdWords login information. > > private static final String email = "[EMAIL PROTECTED]"; > > private static final String password = "password"; > > private static final String useragent = "ANY VALUE"; > > private static final String clientEmail = "client_1"+email; > > private static final String developerToken = email+"++INR"; > > private static final String applicationToken = email+"++INR"; > > private static final String namespace = "https:// > > sandbox.google.com/api/adwords/v12"; > > > public static void main(String[] args) { > > try { > > // Set up service connection. > > AccountInterface service = new > > AccountServiceLocator().getAccountService(); > > > // Define SOAP headers. > > ((Stub) service).setHeader(namespace, "email", email); > > ((Stub) service).setHeader(namespace, "password", > > password); > > ((Stub) service).setHeader(namespace, "clientEmail", > > clientEmail); > > ((Stub) service).setHeader(namespace, "useragent", > > useragent); > > ((Stub) service).setHeader(namespace, "developerToken", > > developerToken); > > ((Stub) service).setHeader(namespace, "applicationToken", > > applicationToken); > > > // Get account info. > > AccountInfo accountInfo = service.getAccountInfo(); > > > // Display account info. > > System.out.println("Account name is \"" > > + accountInfo.getDescriptiveName() + "\", id is > > \"" > > + accountInfo.getCustomerId() + "\", and currency > > code is \"" > > + accountInfo.getCurrencyCode() + "\"."); > > > } catch (Exception e) { > > e.printStackTrace(); > > } > > } > > > =========================== > > Please clarify my doubts. > > > Thanks in Advance, > > Sachin --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en -~----------~----~----~----~------~----~------~--~---