Thank you Jaap and Jeff,

Now I've got it by using adwords-api-3.0.0.jar.
:)
Thank you very much for your time.


On Mar 13, 12:09 am, AdWords API Advisor
<adwordsapiadvi...@google.com> wrote:
> Hello,
>
>  After consulting with the Java client library's maintainer, I think
> what is happening here is that you downloaded and are using the
> awapi_java_lib_3.0.0_src.tar.gz package. This is fine in an of itself,
> but the package requires post-processing with AspectJ in order to
> manipulate the classes a bit. It also requires downloading a separate
> set of dependency .jars and including them in your project.
>
>  What he says is much easier is if you use
>
>  http://google-api-adwords-java.googlecode.com/files/adwords-api-3.0.0...
>
> which is the compiled and post-processed client library, together with
> the dependency .jars, together in one large .jar. This is the version
> of the client library that we'll be steering users towards in the
> future, and we're going to remove the link to the source-only version
> from the main page to prevent further confusion. Given that there are
> people out there who do need to compile the .jar from source to
> incorporate their own modifications, or because they need to supply
> their own dependencies, we'll still be making the source-only
> distribution available (and you could always check out the code from
> SVN).
>
>  Can you download adwords-api-3.0.0.tar.gz and give things a try with
> that?
>
> Cheers,
> -Jeff Posnick, AdWords API Team
>
> On Mar 12, 8:08 am, Jaap <jaap.fors...@gmail.com> wrote:
>
>
>
> > Dear PPL,
>
> > I have copy-pasted all your codes, filled in my credentials and ran
> > the program. It worked immediately, not giving me the exception that
> > occurs in your code. The only thing that might be different between
> > your and my code might be the library we are using. I am using adwords-
> > api-3.0.0.jar as a library.
>
> > If the problem isn't the library I'm afraid I'm out of ideas. Your
> > code is correct and the error you are describing is something that as
> > far as I can tell is a result of something going wrong in the library
> > code.
>
> > Sorry I can't be of further help.
>
> > On 12 mrt, 12:17, PPL <ppl...@gmail.com> wrote:
>
> > > Dear Jaap,
>
> > > The following is my complete code.
>
> > > import java.net.URL;
>
> > > import com.google.api.adwords.lib.AdWordsUser;
> > > import com.google.api.adwords.v13.AccountInfo;
> > > import com.google.api.adwords.v13.AccountInterface;
>
> > > public class AccountServiceDemo {
> > >   public static void main(String args[]) throws Exception {
> > >             String email="a...@gmail.com";
> > >                 String password="aaaa";
> > >                 String userAgent="JIT";
> > >                 String clientEmail="client_1+...@gmail.com";
> > >                 String developerToken="a...@gmail.com++jpy";
> > >                 String appToken="";
>
> > >                 AdWordsUser user=new AdWordsUser(email, password, 
> > > clientEmail,
> > >                               userAgent, developerToken, appToken,
> > >                               "v13",new 
> > > URL("https://sandbox.google.com";));
>
> > >                 AccountInterface service =
> > >                         (AccountInterface) 
> > > user.getService(user.ACCOUNT_SERVICE);
>
> > >                 AccountInfo info = service.getAccountInfo();
>
> > >             System.out.println("Account name is \"" + 
> > > info.getDescriptiveName
> > > ()
> > >                 + "\", id is \"" + info.getCustomerId() + "\", timezone is
> > > \""
> > >                 + info.getTimeZoneId() + "\", language is \""
> > >                 + info.getLanguagePreference() + "\", and currency is \""
> > >                 + info.getCurrencyCode() + "\".");
> > >   }
>
> > > }
>
> > > But I'm still getting  the same error.
>
> > > Exception in thread "main" javax.xml.rpc.ServiceException:
> > > java.lang.ClassCastException:
> > > com.google.api.adwords.v13.AccountServiceSoapBindingStub cannot be
> > > cast to com.google.api.adwords.lib.AdWordsService
> > >         at com.google.api.adwords.lib.BaseCredentials.getService
> > > (BaseCredentials.java:178)
> > >         at main.AccountServiceDemo.main(AccountServiceDemo.java:42)
>
> > > Sorry to bother you time and again.
> > > Thank you.
>
> > > On Mar 12, 6:35 pm, Jaap <jaap.fors...@gmail.com> wrote:
>
> > > > Hi PPL,
>
> > > > I copied your code to try it out.
> > > > The first error I get is: Exception in thread "main"
> > > > java.lang.ClassCastException:
> > > > com.google.api.adwords.v12.AccountServiceSoapBindingStub
>
> > > > This happens because I have imported the v13 classes and it is trying
> > > > to cast to v12. To fix this either switch to v12 (which you shouldn't
> > > > do because that version is no longer supported) or provide the code
> > > > with an explicit version. I assume this will be fixed in future
> > > > version of the toolkit. As far as I can see there are two AdWordsUser
> > > > constructors that support version directly, and otherwise you will
> > > > need to use a map with certain string-value pairs:
>
> > > > AdWordsUser user = new AdWordsUser
> > > > (email,password,userAgent,developerToken,appToken, "v13", null);
>
> > > > However you are now communicating with the production servers and not
> > > > with the sandbox as you indicated you wanted in the subject title. The
> > > > sandbox requires the clientid header to be set, and requires an
> > > > alternate url.
>
> > > > The complete call to create an adwords user object would now be:
>
> > > > AdWordsUser user = new AdWordsUser(email, password, clientEmail,
> > > > userAgent, developerToken, appToken, "v13", new URL("https://
> > > > sandbox.google.com"));
>
> > > > The rest of your code should work, however while testing I'm getting
> > > > an error with code 0 meaning the sandbox is currently not working
> > > > properly. So I can't test your code further. Also your clientEmail
> > > > string is malformed it should be client_1+...@gmail.com
>
> > > > On 12 mrt, 10:56, PPL <ppl...@gmail.com> wrote:
>
> > > > > Dear Jaap,
>
> > > > > Could you please send me the small working code(project) of that API,
> > > > > if possible?
> > > > > I'm facing the same error when I test other services.
> > > > > I want to know the usage of those services.
> > > > > Otherwise I can't even step further.
> > > > > :(
>
> > > > > Thank you.
>
> > > > > On Mar 12, 5:30 pm, PPL <ppl...@gmail.com> wrote:
>
> > > > > > Dear Jaap,
>
> > > > > > Thank you very much for your suggesstion.
> > > > > > Below is my code.
>
> > > > > > public static void main(String args[]) throws Exception {
> > > > > >        // Get credentials and service
> > > > > >           String email="a...@gmail.com";
> > > > > >           String password="aaaaa";
> > > > > >           String userAgent="JIT";
> > > > > >           String clientEmail="client1+...@gmail.com";
> > > > > >           String developerToken="a...@gmail.com++jpy";
> > > > > >           String appToken="";
> > > > > >           // Get credentials and service
>
> > > > > >             AdWordsUser user = new AdWordsUser
> > > > > > (email,password,userAgent,developerToken,appToken);
>
> > > > > >             AccountInterface service =
> > > > > >                 (AccountInterface) 
> > > > > > user.getService(user.ACCOUNT_SERVICE);
>
> > > > > >             // Diplays the account's name, timezone, language, and 
> > > > > > currency.
> > > > > >             AccountInfo info = service.getAccountInfo();
>
> > > > > >     System.out.println("Account name is \"" + 
> > > > > > info.getDescriptiveName
> > > > > > ()
> > > > > >         + "\", id is \"" + info.getCustomerId() + "\", timezone is 
> > > > > > \""
> > > > > >         + info.getTimeZoneId() + "\", language is \""
> > > > > >         + info.getLanguagePreference() + "\", and currency is \""
> > > > > >         + info.getCurrencyCode() + "\".");
> > > > > >   }
>
> > > > > > But I still got the same error.
> > > > > > I've already import all of the dependencies according to the Readme 
> > > > > > of
> > > > > > java client library.
> > > > > > Could you please point out the source of the error?
>
> > > > > > Thank you.
>
> > > > > > On Mar 12, 4:18 pm, Jaap <jaap.fors...@gmail.com> wrote:
>
> > > > > > > Hi PPL,
>
> > > > > > > According to the google adwords API, AccountServiceSoapBindingStub
> > > > > > > extends org.apache.axis.client.Stub, and implements 
> > > > > > > AccountInterface.
> > > > > > > The ClassCastException occurs because you are try to cast to a 
> > > > > > > class
> > > > > > > which is not implemented nor extended by
> > > > > > > AccountServiceSoapBindingStub. Presumably you got the service by 
> > > > > > > doing
> > > > > > > something like this:
> > > > > > > AdWordsService service = (AdWordsService)user.getService
> > > > > > > (AdWordsUser.ACCOUNT_SERVICE);
>
> > > > > > > This should be
> > > > > > > AccountInterface interface = (AccountInterface)user.getService
> > > > > > > (AdWordsUser.ACCOUNT_SERVICE);
>
> > > > > > > The interface can be used to communicate with the API.
>
> > > > > > > Hope this helps.
>
> > > > > > > On 12 mrt, 03:38, PPL <ppl...@gmail.com> wrote:
>
> > > > > > > > Hi anybody,
>
> > > > > > > > Could you please help me to find out the answer of that error?
>
> > > > > > > > Exception in thread "main" javax.xml.rpc.ServiceException:
> > > > > > > > java.lang.ClassCastException:
> > > > > > > > com.google.api.adwords.v13.AccountServiceSoapBindingStub cannot 
> > > > > > > > be
> > > > > > > > cast to com.google.api.adwords.lib.AdWordsService
> > > > > > > >         at com.google.api.adwords.lib.BaseCredentials.getService
> > > > > > > > (BaseCredentials.java:178)
> > > > > > > >         at 
> > > > > > > > main.AccountServiceDemo.main(AccountServiceDemo.java:44)
>
> > > > > > > > I can't even step forward cause of it.
>
> > > > > > > > I'm looking forward to you.
> > > > > > > > Thank you.
>
> > > > > > > > On Mar 11, 1:12 pm, PPL <ppl...@gmail.com> wrote:
>
> > > > > > > > > Dear Jeff,
> > > > > > > > > When I tried to run the AccountServiceDemo from the java 
> > > > > > > > > client
> > > > > > > > > library, the
>
> ...
>
> read more »- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to