Hey Laura,

It kind of depends on what stage of implementation you're at. Though one
thing is for sure, the sample container isn't really terribly good way of
seeing if things work.

If you just started to implement your own classes, so say you have a custom
PeopleService implementation, but are lacking the rest (iframe's, encrypted
security tokens etc), then I always prefer to use the opensocial client
libraries and just code whichever call I want to test. You can find the php
version here: http://code.google.com/p/opensocial-php-client/

So in this humble beginning, you would use the 'SecurityToken' auth class
with a matching text string (the format is:
john.doe:john.doe:appid:cont:url:0:default), of course do replace the
john.doe with the user id you want to test for, and make sure that
allow_plaintext_tokens & debug are set to true in your local config.

Then you can create a basic script that does something like:

<?php

// add osapi to include path and require the base file (which pulls in the
rest of the lib)
set_include_path(get_include_path() . PATH_SEPARATOR . '/path/to/osapi');
require_once "osapi.php";

// provider, this is an example of manual configuration, oauth end points
are 'null' (ie: not available), and we define the REST and RPC end points
// Note: when both RPC and REST is available, it will use the RPC one by
default ... so to test the REST interface, simply set the RPC var to NULL
$provider = new osapiProvider(null, null, null, '
http://local.shindig.url/social/rest', 'http://local.shindig.url/social/rpc',
'my local shindig', true);

// Auth to use, in this case it's a plain text security token, but encrypted
security tokens and 2 and 3 legged OAuth are also supported
$auth = new
osapiSecurityToken('john.doe:john.doe:appid:cont:url:0:default');

// And instance the real osapi class using the provider & auth classes
$osapi = new osapi($provider, $auth);

// Instance a batch object, requests can be batched together, and if RPC is
used, will be executed in a single call.. if only REST is available, it'll
do multiple calls, one for each request

// Do something, in this example we're fetching /people/@me/@self
$batch->add(
   $osapi->people->get(array('userId'=>'@me', 'groupId'=>'@self')),
   'selfLabel'
);

// execute the request:
$result = $batch->execute();

// print the results to screen
print_r($result);


And once the basic 'getPerson' function works as you want it too, you can
make it fetch @me/@friends, use params like 'startIndex' => 2, etc etc...
until it properly does all you want it to.

Once that's done, you can go look at how to construct the iframe and secure
tokens (encrypted), implement the gadget->container js rpc functions, and
once that is all done, you can run the 0.8.1 compliance test suite:
http://opensocial-resources.googlecode.com/svn/tests/trunk/suites/0.8/compliance/reference.xmland
take it from there. (Some errors is to be expected, a great result is
120-130 succeeded).

Also at any of these steps, you can look at how Partuza (a demo/example SNS
implementation that is created just to show how to implement php shindig)
implemented it: http://code.google.com/p/partuza/ Sometimes having a
practical example can make all the difference :)

Good luck & I look forward to hearing how things are progressing :)

   -- Chris

On Wed, Jul 8, 2009 at 10:22 PM, Laura Nathanson
<[email protected]>wrote:

> Sorry forgot to mention I'm using PHP shindig..
>
> On Wed, Jul 8, 2009 at 4:18 PM, Laura Nathanson
> <[email protected]>wrote:
>
> > Hi there,
> > I'd like to confirm that my person service is implemented correctly
> > by getting a list of friends to display in the sample container, using
> the
> > getFriendsHasApp.xml gadget that comes with the code. However, even
> before
> > hooking up my person service, the gadget does not work as given - it
> doesn't
> > display any friends john.doe for the sample data set. When I inspect the
> > responseItem, I see that hadError = true, errorMessage = undefined, and
> > errorCode = internalError.
> >
> > Now, I'd like to dig in and see why this internal error is happening. But
> > I'm not grasping a core concept here.. How does the gadget know to talk
> to
> > my version of shindig for its opensocial requests? Where does that
> > association happen? When the gadget says "req.Send()", who handles that?
> >
> > Laura
> >
> >
> >
>

Reply via email to