Exception thrown in ClientType.php

Apr 3, 2011 at 4:43 AM

Been a long (very long) time since I've programmed. Had something I wanted to do with NetFlix and ended up landing on the OData via PHP option. However, even time I try to use the program it throws an exception in ClientTable. Actually the code that catches the exception then throws a new InvalidOperation('ReflectionException in ClientType constructor');

I printed out the exception and this is what I got:

 

exception 'ReflectionException' with message 'Class Model does not exist' in C:\php\includes\odata\framework\Common\ClientType.php:46
Stack trace:
#0 C:\php\includes\odata\framework\Common\ClientType.php(46): ReflectionClass->__construct('Model')
#1 C:\php\includes\odata\framework\Common\ClientType.php(157): ClientType->ClientType('Model')
#2 C:\php\includes\odata\framework\Parser\AtomParser.php(568): ClientType::Create('Model')
#3 C:\php\includes\odata\framework\Parser\AtomParser.php(493): AtomParser->CheckAndProcessComplexType(Object(DOMXPath), 'm:properties/d:', 'BoxArt', '', NULL)
#4 C:\php\includes\odata\framework\Parser\AtomParser.php(258): AtomParser->HandleProperties(Object(DOMXPath), 'm:properties/d:', Object(ClientType), Object(Title))
#5 C:\php\includes\odata\framework\Parser\AtomParser.php(168): AtomParser->EnumerateEntry(Object(DOMElement), 'Title', NULL)
#6 C:\php\includes\odata\framework\Parser\AtomParser.php(142): AtomParser->EnumerateFeed(Object(DOMElement), 'Titles')
#7 C:\php\includes\odata\framework\Context\ObjectContext.php(698): AtomParser->EnumerateObjects(Object(QueryOperationResponse))
#8 C:\php\includes\odata\framework\Context\DataServiceQuery.php(366): ObjectContext->ExecuteAndProcessResult(Object(HttpRequest), '2.0')
#9 C:\wamp\www\netflix\Netflix-API\apitest.php(209): DataServiceQuery->Execute()
#10 C:\wamp\www\netflix\Netflix-API\apitest.php(35): GetMovies('johnny mn')
#11 {main}

Now, if I don't throw the Invalid Operation, the program continues on and seems to do what it should. Not sure what this is trying to do or how to fix it.

I'm on Windows 7 and my setup is a WAMP setup.

Any insight/help is appreciated. - David.
Jun 4, 2011 at 11:08 PM

I'm having almost the same problem. I've been able to use the SDK with other Services (e.g. Northwind) but not Netflix. Here's the error I'm getting:

[04-Jun-2011 16:58:23] PHP Fatal error:  Uncaught exception 'InvalidOperation' in C:\php\extensions\odataphp\Common\ClientType.php:136
Stack trace:
#0 C:\php\extensions\odataphp\Common\ClientType.php(153): ClientType->ClientType('Catalog')
#1 C:\php\extensions\odataphp\Parser\AtomParser.php(568): ClientType::Create('Catalog')
#2 C:\php\extensions\odataphp\Parser\AtomParser.php(493): AtomParser->CheckAndProcessComplexType(Object(DOMXPath), 'm:properties/d:', 'BluRay', '', NULL)
#3 C:\php\extensions\odataphp\Parser\AtomParser.php(258): AtomParser->HandleProperties(Object(DOMXPath), 'm:properties/d:', Object(ClientType), Object(Title))
#4 C:\php\extensions\odataphp\Parser\AtomParser.php(168): AtomParser->EnumerateEntry(Object(DOMElement), 'Title', NULL)
#5 C:\php\extensions\odataphp\Parser\AtomParser.php(142): AtomParser->EnumerateFeed(Object(DOMElement), 'Titles')
#6 C:\php\extensions\odataphp\Context\ObjectContext.php(698): AtomParser->EnumerateObjects(Object(QueryOperationResponse))
#7 C:\php\extensions\odataphp\Context\DataServiceQuery.php(366): Ob in C:\php\extensions\odataphp\Common\ClientType.php on line 136

Here's my code:

$svc = new Netflixcatalog("http://odata.netflix.com/catalog");
$query = $svc->Titles()
             ->Filter("Rating eq 'PG' and ReleaseYear eq 1983")
             ->OrderBy("AverageRating desc")
             ->Top(10);
$response= $query->Execute();   
$result = $response->Result;

Here is how I generated the proxy:

php PHPDataSvcUtil.php /uri=http://services.odata.org/Northwind/Northwind.svc/

No idea what's going on here - does anyone have any ideas?