Okay I found out the exact error message the service.query(query)
returned a null or incorrect data.
Error msg: System.NullReferenceException: Object reference not set to
an instance of an object.
Heres my code snippet and this is happening on /health. requesting of
token is good but once I do the query the service returns an incorrect
data or no data at all and caused the error. The weird thing is this
problem is very hard to replicate, I myself can't replicate it and
most of the time it retuns the correct data. Except for the one person
on the google healthservices team, they're getting mixed results
there, others can't even replicate it. What is causing this problem?
AtomFeed healthFeed = service.Query(query);
foreach (AtomEntry entry in healthFeed.Entries) <---caused the error
because healthfeed is null
pls help.
On Oct 15, 12:26 pm, "Eric (Google)" <[EMAIL PROTECTED]> wrote:
> On Oct 15, 11:38 am, "MWW Code" <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > Hi Eric,
> > So my client was asking if thiserror"Invalid Usage, Sharing denied:
> > unregistered provider." was caused by that non-registration.
> > Could you confirm?
> > I'll also paste my code so you may check if I missed something.
>
> > <?
> > function getAuthSubUrl()
> > {
> > $next = getCurrentUrl();
> > $scope =
> > 'https://www.google.com/health/feeds/';#scope:https://www.google.com/health/feeds/
> > $authSubHandler = 'https://www.google.com/health/authsub';
> > $secure = 1;
> > $session= 1;
> > return Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope, $secure,
> > $session, $authSubHandler);
>
> > }
>
> You should still be using all /h9 URLs (unless you've been approved to
> use /health).
> But from what you've mentioned, it sounds like your domains have been
> registered for /h9. Being whitelisted for /health is the final step
> for integration.
> So:
> $authSubHandler=khttps://www.google.com/h9/authsub
> $scope=https://www.google.com/h9/feeds/
>
>
>
>
>
>
>
> > function requestUserLogin($linkText)
> > {
> > $authSubUrl = getAuthSubUrl();
> > $authSubUrl = str_replace("/accounts/AuthSubRequest", "/health/authsub",
> > $authSubUrl); #makes the AuthSub path
> > to:https://www.google.com/health/authsub
>
> > $authSubUrl = $authSubUrl . "&permission=1";
> > return "<a href=\"{$authSubUrl}\">{$linkText}</a>";
>
> > }
>
> > function getAuthSubHttpClient()
> > {
> > global $_SESSION, $_GET;
>
> > $client = new Zend_Http_Client();
>
> Use this new: Zend_Gdata_HttpClient();
>
>
>
>
>
> > // This sets your private key to be used to sign subsequent requests
> > $client->setAuthSubPrivateKeyFile('parsakey.pem', null, true); # --
> > parsakey.pem is in the same directory as the calling page
> > $sessionToken =
> > Zend_Gdata_AuthSub::getAuthSubSessionToken(trim($_GET['token']), $client);
>
> > // Set the long-livedsessiontokenfor subsequent requests
> > $client->setAuthSubToken($sessionToken);
> > return $client;
>
> > }
>
> > // The calling page
>
> > # :
> > # :
> > # :
> > else {
> > try{
> > $client = getAuthSubHttpClient();
>
> > $healthService = new Zend_Gdata($client);
> > # :
> > # :
> > # :
> > ?>
>
> > On Wed, Oct 15, 2008 at 11:22 AM, Eric (Google) <[EMAIL PROTECTED]> wrote:
>
> > > On Oct 14, 3:25 pm, "MWW Code" <[EMAIL PROTECTED]> wrote:
> > > > Hi Eric,
> > > > Sorry for the nag, but I tried to make it happen like on the sample you
> > > gave
> > > > me, and then now I get a "Invalid Usage, Sharing denied: unregistered
> > > > provider.". I'm actually aware that its a registration thing with Google
> > > > Health, yet someone from Google already asked us about which domains to
> > > > register. I just wanna confirm if this might be anerrorcause by a
> > > possibly
> > > > not registering to Google Health.
>
> > > Yes. It can take up to a week for the domain registrations to be
> > > updated.
> > > If you've received an email, then it shouldn't be long :)
>
> > > Eric
>
> > > > Thanks again.
>
> > > > On Sat, Oct 11, 2008 at 6:33 AM, Eric (Google) <[EMAIL PROTECTED]>
> > > wrote:
>
> > > > > The Authorization header is slightly more complex
> > > > > for secure=1 than secure=0 tokens:
> > > > >http://code.google.com/apis/health/developers_guide_protocol.html#Aut.
> > > ..
>
> > > > > In short, you need to create a private key and public certificate
> > > > > to sign requests. Refer to the steps here for registration:
> > > > >http://code.google.com/apis/health/getting_started.html#DomainRegistr.
> > > ..
>
> > > > > and here's code for using AuthSub with secure=1:
>
> > > > >http://gdatatips.blogspot.com/2008/09/secure-authsub-using-zend-php-l.
> > > ..
>
> > > > > Eric
>
> > > > > On Oct 10, 3:17 pm, "MWW Code" <[EMAIL PROTECTED]> wrote:
> > > > > > Hi Eric,
>
> > > > > > Its been quite a while since I wrote and seems that I really need
> > > your
> > > > > help.
> > > > > > I have the same problem. Things are running good for our Google
> > > Health
> > > > > app
> > > > > > with secure=0, but with secure=1 I get anError:Tokenupgrade
> > > failed.
> > > > > > Reason: Invalid AuthSub header.Error401.
>
> > > > > > I haven't changed my code since then til we need to use secure=1
> > > > > > that
> > > I
> > > > > > found it ain't pushing through.
>
> > > > > > Code is as follows:
>
> > > > > > function getAuthSubUrl()
> > > > > > {
> > > > > > $next = getCurrentUrl();
> > > > > > $scope = "https://www.google.com/h9/feeds"; # uncomment upon
> > > > > deployment
> > > > > > $secure = 1;
> > > > > > $session= 1;
> > > > > > return Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope,
> > > $secure,
> > > > > > $session);
>
> > > > > > }
>
> > > > > > function requestUserLogin($linkText)
> > > > > > {
> > > > > > $authSubUrl = getAuthSubUrl();
> > > > > > $authSubUrl = str_replace("/accounts/AuthSubRequest",
> > > "/h9/authsub",
> > > > > > $authSubUrl);
> > > > > > $authSubUrl = $authSubUrl . "&permission=1";
> > > > > > return "<a href=\"{$authSubUrl}\">{$linkText}</a>";
>
> > > > > > }
>
> > > > > > function getAuthSubHttpClient()
> > > > > > {
> > > > > > global $_SESSION, $_GET;
> > > > > > if (!isset($_SESSION['sessionToken']) && isset($_GET['token'])) {
> > > > > > $_SESSION['sessionToken'] =
> > > > > > Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token'], null, "
> > > > >https://www.google.com/accounts/AuthSubSessionToken"); //* <-- code
> > > gets
> > > > > > preempted here*
> > > > > > }
> > > > > > $client =
> > > Zend_Gdata_AuthSub::getHttpClient($_SESSION['sessionToken']);
> > > > > > return $client;
>
> > > > > > }
>
> > > > > > // the executing code is:
>
> > > > > > try{
> > > > > > $client = getAuthSubHttpClient();
> > > > > > $healthService = new Zend_Gdata($client);
>
> > > > > > $profileFeedUri = '
> > > > >https://www.google.com/h9/feeds/profile/default?digest=true';
> > > > > > $query = new Zend_Gdata_Query($profileFeedUri);
>
> > > > > > $feed = $healthService->getFeed($query);- Hide
> > > > > > quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Health Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/googlehealthdevelopers?hl=en
-~----------~----~----~----~------~----~------~--~---