在Google的API中获取NullPointerException使用Google的Billing API时

时间:2011-05-09 08:19:07

标签: google-checkout

此问题与Google Marketplace应用的结算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客户端-1.2.1-alpha.jar, 谷歌-API的客户端 - googleapis-1.2.1-α

请帮忙。

0 个答案:

没有答案