Custom entity, entity_save() leads to PDO Exception?
The problem is centred around this bit of code:

$e = entity_create ('person', array(
  $entity-&gt;name = $message['params']['last_name'],
  $entity-&gt;field_person_copy['und'][0]['value'] = 'NO',
));


It's sort-of-technically-valid PHP (though you don't have a variable named $entity in scope), but certainly isn't doing what you expect. It's almost like you're trying to apply a feature from another language (like object initialisers from C# maybe).

I'm guessing somewhat, but I imagine what you're trying to do is:

$e = entity_create ('person', array(
  'BUNDLE_KEY' =&gt; 'BUNDLE_NAME',
  'name' =&gt; $message['params']['last_name'],
));

$e-&gt;field_person_copy[LANGUAGE_NONE][0]['value'] = 'NO';

entity_save('person', $e);


Or maybe

$e = entity_create ('person', array(
  'BUNDLE_KEY' =&gt; 'BUNDLE_NAME',
));

$e-&gt;name = $message['params']['last_name'];
$e-&gt;field_person_copy[LANGUAGE_NONE][0]['value'] = 'NO';

entity_save('person', $e);


Where BUNDLE_KEY and BUNDLE_NAME are whatever you have set up for your entity type.