【问题标题】:How to enable Request and Response Logging in the .Net DevKit V2如何在 .Net DevKit V2 中启用请求和响应日志记录
【发布时间】: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);

【问题讨论】:

标签: .net logging quickbooks intuit-partner-platform devkit


【解决方案1】:

这里有两篇关于在 SDK 中启用 .Net 或 Java 登录的论坛帖子,还有一篇关于 Java 的博文 。网 https://ipp.developer.intuit.com/0010_Intuit_Partner_Platform/0200_DevKits_for_Intuit_Partner_Platform/0100_IPP_.NET_DevKit/0600_Logging

Java http://ippblog.intuit.com/blog/2012/07/ipp-java-devkit-logger.html

谢谢
震动

【讨论】:

  • 我不明白。与 InvoiceAdd 请求相关的代码应该放在哪里?
  • 我按照我的第一篇文章中的说明进行了一些更改,以使用相同的 ServiceConext 但新的 OauthRequestValidator 并且它通过了,但日志记录位置文件夹中没有任何内容。还需要做什么?
  • 它在实例化 ServiceContext 类时抛出异常,这是设置日志参数的原因,因此不会被记录。您将需要使用 Fiddler 或 Charles 代理来捕获请求/响应。请在此处发布结果。如上所述,您是否在 API Explorer 中测试了令牌?
  • 该链接是我在我的帖子中开始的地方,但它并没有真正解释在哪里参考其他任何内容。我目前正在使用示例 C# HelloIntuitAnywhere。在 C# 中是否有完整的工作示例。
  • 您上面启用日志记录的代码是正确的。问题是当您在尝试获取 QBO 的基本 URL 时实例化 ServiceContext 时会引发异常。
猜你喜欢
  • 2018-12-20
  • 2022-06-21
  • 2017-08-07
  • 1970-01-01
  • 2011-12-18
  • 2013-04-04
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多