0

How to enable logging for the XML?

I tried to follow the directions from http://docs.developer.intuit.com/0025_Intuit_Anywhere/0200_DevKits/0100_IPP_.NET_DevKit/0600_Logging

I put the code in a test program derived from the HelloIntuitAnywhere for a Transaction Add

So I put it under the normal setting in our InvoiceAdd procedure

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";

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

But get InvalidTokenException on

context = new ServiceContext(oauthValidator, realmId, IntuitServicesType.QBO);
GargantuChet
  • 5,691
  • 1
  • 30
  • 41
QuickBooksDev
  • 125
  • 1
  • 1
  • 9
  • 1
    When the ServiceContext is instantiated for QBO, the DevKit makes a call to get the realm's base URL: http://docs.developer.intuit.com/0025_Intuit_Anywhere/0050_Data_Services/v2/0400_QuickBooks_Online/0100_Calling_Data_Services/0010_Getting_the_Base_URL This is where it is failing. The OAuth tokens are expired or not valid for the realm you are making the call for. You can test the tokens in the API Explorer: http://apiexplorer.developer.intuit.com/ – Peter Lavelle Mar 04 '13 at 21:47

1 Answers1

1

Here are two forum posts for enabling .Net or Java logging in the SDKs, also a blog post for Java .Net 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

thanks
Jarred

Jarred Keneally
  • 1,931
  • 11
  • 12
  • I do not understand. WHERE should be code be put in relation to the InvoiceAdd, request? – QuickBooksDev Mar 06 '13 at 22:12
  • I put it as indicated in my first posting with some changes to use the same ServiceConext but a new OauthRequestValidator and it goes through but there is nothing in the logging location folder. What else has to be done? – QuickBooksDev Mar 06 '13 at 22:18
  • 1
    It's throwing an exception instantiating the ServiceContext class, which is what sets the logging parameters, so it will not be logged. You will need to use Fiddler or Charles proxy to capture the request/response. Please post the results here. Did you test the tokens in the API Explorer as I mentioned above? – Peter Lavelle Mar 08 '13 at 14:40
  • The link is where I started from in the post of my post but it does not really explain where to put it in reference to anything else. I am currently use the sample C# HelloIntuitAnywhere. Is there a complete working sample of this in C# anywhere. – QuickBooksDev Mar 09 '13 at 11:39
  • 1
    Your code above to enable logging is correct. The issue is that the ServiceContext throws an exception when you are instantiating it when trying to get the base URL for QBO. – Peter Lavelle Mar 13 '13 at 03:26