Skip to content

Can't parse input object #16

@DAThosting

Description

@DAThosting

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions