Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在.Net DevKit V2中启用请求和响应日志记录_.net_Logging_Quickbooks_Intuit Partner Platform_Devkit - Fatal编程技术网

如何在.Net DevKit V2中启用请求和响应日志记录

如何在.Net DevKit V2中启用请求和响应日志记录,.net,logging,quickbooks,intuit-partner-platform,devkit,.net,Logging,Quickbooks,Intuit Partner Platform,Devkit,如何为XML启用日志记录 我试着按照他的指示去做 我将代码放在一个测试程序中,该程序派生自HelloIntuitAnywhere,用于事务添加 所以我把它放在InvoiceAdd程序的正常设置下 realmId=HttpContext.Current.Session[“realm”].ToString(); accessToken=HttpContext.Current.Session[“accessToken”].ToString(); accessTokenSecret=HttpConte

如何为XML启用日志记录

我试着按照他的指示去做

我将代码放在一个测试程序中,该程序派生自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);
ConsumerCret=ConfigurationManager.AppSettings[“ConsumerCret”].ToString(CultureInfo.InvariantCulture);
intuitServiceType=(intuitServiceType)HttpContext.Current.Session[“intuitServiceType”];
oauthValidator=新的OAuthRequestValidator(accessToken、accessTokenSecret、consumerKey、ConsumerCret);
上下文=新的ServiceContext(oauthValidator、realmId、intuitServiceType);
commonService=新的数据服务(上下文);
////////////////////////////////////////////
//OAuthRequestValidator
oauthValidator=新的OAuthRequestValidator(“,
"",
"",
"");
//ServiceContext
context=newServiceContext(oauthValidator、realmId、IntuitServicesType.QBO);
context.EnableServiceRequestsLogging=true;
context.ServiceRequestLoggingLocation=@“c:\IPPlogs”;
//////////////////////////////////////////
但是请打开InvalidTokenException

context=newServiceContext(oauthValidator、realmId、IntuitServicesType.QBO);

这里有两篇关于在SDK中启用.Net或Java日志的论坛帖子,也是一篇关于Java的博客帖子 .Net

爪哇

谢谢

Jarred

当为QBO实例化ServiceContext时,DevKit会调用以获取领域的基本URL:这就是它失败的地方。OAuth令牌已过期或对于您正在进行调用的领域无效。您可以在API资源管理器中测试令牌:我不明白。与InvoiceAdd、request相关的代码应该放在哪里?我把它放在了我第一次发布中指出的位置,并做了一些更改,以使用相同的ServiceConText,但使用了一个新的OauthRequestValidator,它通过了,但logging location文件夹中没有任何内容。还需要做什么?它会抛出一个实例化ServiceContext类的异常,这是设置日志参数的原因,因此不会记录它。您需要使用Fiddler或Charles proxy来捕获请求/响应。请把结果贴在这里。你有没有像我上面提到的那样在API浏览器中测试令牌?这个链接是我在文章中开始的地方,但它并没有真正解释在引用其他任何东西时应该把它放在哪里。我目前正在任何地方使用示例C#HelloIntuit。在C#anywhere中是否有完整的工作示例。上面用于启用日志记录的代码是正确的。问题在于,当您试图获取QBO的基本URL时,ServiceContext在实例化它时会引发异常。