【发布时间】:2013-03-04 21:11:14
【问题描述】:
如何为 XML 启用日志记录?
我试着按照 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 on
context = new ServiceContext(oauthValidator, realmId, IntuitServicesType.QBO);
【问题讨论】:
-
当为 QBO 实例化 ServiceContext 时,DevKit 会调用以获取领域的基本 URL:docs.developer.intuit.com/0025_Intuit_Anywhere/… 这是失败的地方。 OAuth 令牌对于您正在调用的领域已过期或无效。您可以在 API Explorer 中测试令牌:apiexplorer.developer.intuit.com
标签: .net logging quickbooks intuit-partner-platform devkit