使用 Google 的计费 API 时,在 Google 的 API 中获取 NullPointerException
这个问题与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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论