使用 Google 的计费 API 时,在 Google 的 API 中获取 NullPointerException

发布于 2024-11-06 01:47:44 字数 1288 浏览 1 评论 0原文

这个问题与Google Marketplace App的计费API有关。我正在尝试按照以下位置提到的步骤获取客户许可证: http://code.google.com/googleapps/marketplace/v2/developers_guide.html#customer_license

我的代码是:

AppsMarketService service = new AppsMarketService();
service.appId = myAppID;
service.appName = "MyApp";
service.endpoint = "https://www.googleapis.com/appsmarket/v2/";
service.consumerKey = service.appId + ".apps.googleusercontent.com";
service.consumerSecret = MyAppSecretKey;
service.authorize();
CustomerLicense customerLicense = service.getCustomerLicense("example.com", true);

但出现以下异常:

java.lang.NullPointerException
    at com.google.appengine.api.urlfetch.URLFetchServiceImpl.fetch(URLFetchServiceImpl.java:31)
    at com.google.api.client.appengine.UrlFetchRequest.execute(UrlFetchRequest.java:80)
    at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:207)
    at com.google.api.client.sample.appsmarket.AppsMarketService.getCustomerLicense(AppsMarketService.java:117)
...

我正在使用以下 API:

appsmarket-2010_12_08.jar, 谷歌-api-client-1.2.1-alpha.jar, google-api-client-googleapis-1.2.1-alpha

请帮忙。

This question is related to Google Marketplace App's billing API. I am trying to get the customer license following the steps mentioned at the following place: http://code.google.com/googleapps/marketplace/v2/developers_guide.html#customer_license

My code is:

AppsMarketService service = new AppsMarketService();
service.appId = myAppID;
service.appName = "MyApp";
service.endpoint = "https://www.googleapis.com/appsmarket/v2/";
service.consumerKey = service.appId + ".apps.googleusercontent.com";
service.consumerSecret = MyAppSecretKey;
service.authorize();
CustomerLicense customerLicense = service.getCustomerLicense("example.com", true);

But I am getting the following exception:

java.lang.NullPointerException
    at com.google.appengine.api.urlfetch.URLFetchServiceImpl.fetch(URLFetchServiceImpl.java:31)
    at com.google.api.client.appengine.UrlFetchRequest.execute(UrlFetchRequest.java:80)
    at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:207)
    at com.google.api.client.sample.appsmarket.AppsMarketService.getCustomerLicense(AppsMarketService.java:117)
...

I am using the following APIs:

appsmarket-2010_12_08.jar,
google-api-client-1.2.1-alpha.jar,
google-api-client-googleapis-1.2.1-alpha

Please help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文