Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't parse input object #16

Open
DAThosting opened this issue Apr 10, 2022 · 0 comments
Open

Can't parse input object #16

DAThosting opened this issue Apr 10, 2022 · 0 comments

Comments

@DAThosting
Copy link

Hi there,

I know the project is a few years old but I get the following error in PHP 8:
AH01071: Got error 'PHP message: PHP Fatal error: Uncaught org\\nameapi\\client\\fault\\ServiceException: Unexpected late exception translation, caused by: Can't parse input object

My code looks like:

require_once( __DIR__ . '/vendor/optimaize/nameapi-client-php/src/org/nameapi/client/services/ServiceFactory.php');

use org\nameapi\ontology\input\context\Context;
use org\nameapi\ontology\input\context\Priority;
use org\nameapi\client\services\ServiceFactory;
use org\nameapi\ontology\input\entities\person\NaturalInputPerson;
use org\nameapi\ontology\input\entities\person\name\InputPersonName;

$context = Context::builder()
	->place('US')
	->priority(Priority::REALTIME())
    ->build();

$serviceFactory = new ServiceFactory('9f138864435cXXXXXXXXXXXXXXXXXXXX-user1', $context);

$personNameParser = $serviceFactory->parserServices()->personNameParser();
$inputPerson = NaturalInputPerson::builder()
    ->name(InputPersonName::westernBuilder()
        ->fullname( "John Doe" )
        ->build())
    ->build();
$parseResult = $personNameParser->parse($inputPerson);
var_dump($parseResult);

What am I doing wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant