2013-03-04 52 views
0

Request和Response记录如何启用的XML日志?如何启用在.NET的devkit V2

我试图从 http://docs.developer.intuit.com/0025_Intuit_Anywhere/0200_DevKits/0100_IPP_.NET_DevKit/0600_Logging

按照指示我把代码从HelloIntuitAnywhere衍生针对交易测试程序添加

所以我把它放在我们的InvoiceAdd程序

下的正常设置在

realmId = HttpContext.Current.Session["realm"].ToString(); 
accessToken = HttpContext.Current.Session["accessToken"].ToString(); 
accessTokenSecret = HttpContext.Current.Session["accessTokenSecret"].ToString(); 
consumerKey = ConfigurationManager.AppSettings["consumerKey"].ToString(CultureInfo.InvariantCulture); 
consumerSecret = ConfigurationManager.AppSettings["consumerSecret"].ToString(CultureInfo.InvariantCulture); 
intuitServiceType = (IntuitServicesType)HttpContext.Current.Session["intuitServiceType"]; 
oauthValidator = new OAuthRequestValidator(accessToken, accessTokenSecret, consumerKey, consumerSecret); 
context = new ServiceContext(oauthValidator, realmId, intuitServiceType); 
commonService = new DataServices(context); 

//////////////////////////////////////////// 
//OAuthRequestValidator 
oauthValidator = new OAuthRequestValidator("<<accessToken>>", 
    "<<accessTokenSecret>>", 
    "<<consumerKey>>", 
    "<<consumerSecret>>"); 

//ServiceContext 
context = new ServiceContext(oauthValidator, realmId, IntuitServicesType.QBO); 

context.EnableServiceRequestsLogging = true; 
context.ServiceRequestLoggingLocation = @"c:\IPPlogs"; 

////////////////////////////////////////// 

但得到InvalidTokenException

context = new ServiceContext(oauthValidator, realmId, IntuitServicesType.QBO); 
+1

当ServiceContext被实例化QBO时,的devkit进行调用以获取该领域的基础网址: HTTP://docs.develo per.intuit.com/0025_Intuit_Anywhere/0050_Data_Services/v2/0400_QuickBooks_Online/0100_Calling_Data_Services/0010_Getting_the_Base_URL 这是它失败的原因。 OAuth令牌已过期或无效,因为您正在呼叫的领域。您可以在API浏览器测试记号: http://apiexplorer.developer.intuit.com/ – 2013-03-04 21:47:01

回答

1
+0

我不明白。 WHERE应该是代码被放入与InvoiceAdd相关的请求? – QuickBooksDev 2013-03-06 22:12:56

+0

我把它作为我的第一份工作表示了一些变化使用相同的ServiceConext而是一个新的OauthRequestValidator并经过但没有在该记录位置的文件夹。 还有什么要做? – QuickBooksDev 2013-03-06 22:18:22

+1

它引发了一个例外ServiceContext类的异常,该类设置了日志参数,所以它不会被记录。您将需要使用Fiddler或Charles代理来捕获请求/响应。请在这里发布结果。 你有没有在API浏览器测试记号正如我上面提到? – 2013-03-08 14:40:55