locked
Getting permissions error when calling HealthRecordSearcher.GetMatchingItems() RRS feed

  • Question

  • My HealthVault application does not have permission to access the HealthRecordSearcher.GetMatchingItems method. I set the configuration to allow access to OpenQuery in the HV Application Configuration Center under the Methods tab but I still get a permissions error (see below):

     

     

    Microsoft.Health.HealthServiceAccessDeniedException was unhandled by user code

      Message="The application does not have permission to call the specified method."

      Source="Microsoft.Health"

      ErrorCodeId=11

      StackTrace:

           at Microsoft.Health.EasyWebRequest.WaitForCompletion()

           at Microsoft.Health.EasyWebRequest.Fetch(Uri url)

           at Microsoft.Health.EasyWebRequest.Fetch(Uri url, IEasyWebResponseHandler customHandler)

           at Microsoft.Health.HealthServiceRequest.ExecuteInternal()

           at Microsoft.Health.AuthenticatedConnection.ExecuteRequestWithRetry(HealthServiceRequest request)

           at Microsoft.Health.HealthServiceRequest.Execute()

           at Microsoft.Health.HealthRecordSearcher.Execute()

           at Microsoft.Health.HealthRecordSearcher.GetMatchingItems()

           at Utilities.HealthVaultUtilities.GetRecords(HealthServicePage heathServicesPage, Int32 numOfRecordsToGet) in c:\Documents and Settings\michael.brors\My Documents\Visual Studio 2005\WebSites\HealthVaultConnect\svn\HealthVault\App_Code\Utilities\HealthVaultUtilities.cs:line 76

           at _Default.PopulateGridViewQIRecords() in c:\Documents and Settings\michael.brors\My Documents\Visual Studio 2005\WebSites\HealthVaultConnect\svn\HealthVault\Default.aspx.cs:line 124

           at _Default.Page_Load(Object sender, EventArgs e) in c:\Documents and Settings\michael.brors\My Documents\Visual Studio 2005\WebSites\HealthVaultConnect\svn\HealthVault\Default.aspx.cs:line 35

           at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)

           at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)

           at System.Web.UI.Control.OnLoad(EventArgs e)

           at System.Web.UI.Control.LoadRecursive()

           at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

     

     

     

    Here is the calling method…

     

    public static HealthRecordItemCollection GetRecords(HealthServicePage heathServicesPage, int numOfRecordsToGet)

            {

                HealthRecordFilter filter = new HealthRecordFilter();

                filter.TypeIds.Add(new Guid("a5033c9d-08cf-4204-9bd3-cb412ce39fc0"));

      //          filter.XPath = "/QuantumIntechIBISession/Version/";  // It must have a version tag

                filter.MaxItemsReturned = numOfRecordsToGet;

     

                HealthRecordInfo record = heathServicesPage.PersonInfo.SelectedRecord;

                HealthRecordSearcher searcher = record.CreateSearcher();

                searcher.Filters.Add(filter);

     

                System.Collections.ObjectModel.ReadOnlyCollection<HealthRecordItemCollection> results = searcher.GetMatchingItems();

                if (results.Count > 0)

                {

                    return results[0];

                }

     

                return null;

            }

     

     

    Any ideas to why I don't have permission?

     

    Thanks,

     

     

    Monday, August 18, 2008 9:16 PM

Answers

  • hi there :

     

    Sure I just refreshed you methods tab. Your applicaiton did not have access to "GetThings" method and refreshing the methods should add that.

     

    Give a an hour for the application cache to refresh and hopefully it will fix your method access error.

     

    regards,

    Vaibhav

     

    Wednesday, August 20, 2008 5:33 PM

All replies

  • Have you given your application id permissions to access the type "Application-Specific Information" (under online access in application configuration center)?

     

    Raj

    Tuesday, August 19, 2008 11:54 AM
  • Initally I left the default setting for types because it looked like the default was full access to all types. After messing with the permissions I get this error: I'm beginning to thing that this is too complex for people to use. I'm a web developer and if it's this hard for me I can't imagin what a normal user would think.

     

     

    Optional Auth rules not supported

    A mismatch of authorization rules has been detected. Optional auth rules are not supported with this application's base authorization rule set. All authorization rules must contain a name attribute when using optional authorization.

    HealthVault Account home

     

    Tuesday, August 19, 2008 5:51 PM
  • The default setting for types is no access. You need to specifically add access.

     

    In your case, you may need to try the following

     

    You dont need to use optional auth rules.

    Give the application permission (non optional) to the appilcation specific type

    Save Changes

     

    Log on to your healthvault account and remove the access given to the application already - I am asking you to do this since your application's permission changed and it is good if you can force you accout to reauthorize again.

     

    Now, run the web site, login, authorize the appilcation again and you should be good to go.

     

    Btw, the application permission configuation is not something a normal user would fiddle with. It has to be configured only be the developer.

     

    Let me know if you have any questions

     

    Raj

    Tuesday, August 19, 2008 5:59 PM
  •  

    I set up the permissions and when I ran the application it asked for permission for the application... I hit apprive and continue and got the same error as before...

     

    Microsoft.Health.HealthServiceAccessDeniedException was unhandled by user code
      Message="The application does not have permission to call the specified method."
      Source="Microsoft.Health"
      ErrorCodeId=11
      StackTrace:
           at Microsoft.Health.EasyWebRequest.WaitForCompletion()
           at Microsoft.Health.EasyWebRequest.Fetch(Uri url)
           at Microsoft.Health.EasyWebRequest.Fetch(Uri url, IEasyWebResponseHandler customHandler)
           at Microsoft.Health.HealthServiceRequest.ExecuteInternal()
           at Microsoft.Health.AuthenticatedConnection.ExecuteRequestWithRetry(HealthServiceRequest request)
           at Microsoft.Health.HealthServiceRequest.Execute()
           at Microsoft.Health.HealthRecordSearcher.Execute()
           at Microsoft.Health.HealthRecordSearcher.GetMatchingItems()
           at Utilities.HealthVaultUtilities.GetRecords(HealthServicePage heathServicesPage, Int32 numOfRecordsToGet) in c:\Documents and Settings\michael.brors\My Documents\Visual Studio 2005\WebSites\HealthVaultConnect\svn\HealthVault\App_Code\Utilities\HealthVaultUtilities.cs:line 76
           at _Default.PopulateGridViewQIRecords() in c:\Documents and Settings\michael.brors\My Documents\Visual Studio 2005\WebSites\HealthVaultConnect\svn\HealthVault\Default.aspx.cs:line 124
           at _Default.Page_Load(Object sender, EventArgs e) in c:\Documents and Settings\michael.brors\My Documents\Visual Studio 2005\WebSites\HealthVaultConnect\svn\HealthVault\Default.aspx.cs:line 35
           at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
           at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
           at System.Web.UI.Control.OnLoad(EventArgs e)
           at System.Web.UI.Control.LoadRecursive()
           at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

     

    Is there something I need to do at my end? Clear cookies? Flush a cache?

    Tuesday, August 19, 2008 8:12 PM
  •  

    hi there:

     

    What is your application id ? I see that you are not deriving from HealthServicePage but using it as a method variable, does the user get redirected to login before you get the above error?

     

    It seems that your application's method dont have sufficient access  (Message="The application does not have permission to call the specified method.") . The easiest way to fix this is in application configuration center under "methods" tab reset the methods by just hitting save.

     

    Hope this helps.

     

    regards,

    Vaibhav

    Wednesday, August 20, 2008 4:20 PM
  •  

    Hi,

     

    Thanks for the reply... here is the Id (well part of it)

    <add key="ApplicationId" value="xxxxxxxxxxxxxxxxx-b770-6386bb7bc837"/>

    App name is

    QuantumIntech IBI

     

    And that method is called from a page that inherits from the HeathServicePage class. Also note that this method works fine when I use the "Hello World" Id. This must be a configuration issue at HealthVault else I would think when I ran as "Hello World" it would fail.

     

    I have gone to the Application Configuration more times than I can count trying to solve this problem. I have added and removed just about every option/permission there is there.

     

     

    Thanks

    Wednesday, August 20, 2008 5:14 PM
  • hi there :

     

    Sure I just refreshed you methods tab. Your applicaiton did not have access to "GetThings" method and refreshing the methods should add that.

     

    Give a an hour for the application cache to refresh and hopefully it will fix your method access error.

     

    regards,

    Vaibhav

     

    Wednesday, August 20, 2008 5:33 PM
  • Sweet!

     

    Thank you very much!

     

    If this works my team will be overjoyed! I'll let you know in an hour or so.

     

    Wednesday, August 20, 2008 5:43 PM
  • Yes,

     

     

    That did the trick. tyvm!

     

    So for anyone else out there having this problem you need to have someone at HeathVault check the "Hosted Web Application" under the Methods tab in the Application Configuration Center. This will give your application permission to "Get Things".

     

     

    Thanks

    Wednesday, August 20, 2008 6:44 PM