0

i made a soap client and server and have added a sample class, that returns results from doctrines find by methods. however, when i change this to persist or flush objects, the error:

my soap server: (soap controller)

public function server()
{
    if (is_null($this->getRequest()->getParam('wsdl'))) {
         $server = new Zend_Soap_Server('http://localhost/soap?wsdl');
         $server->setClass('Private\Library\Repo\Users');
         $server->handle();
    } else {
         $wsdl = new Zend_Soap_AutoDiscover();
         $wsdl->setClass('Private\Library\Repo\Users');
         $wsdl->handle();
    }
}

public function client()
{
    $client = new Zend_Soap_Client('http://localhost/soap?wsdl');
    $result = $client->updateUser();
}

When I do the call I get:

Message: Unknown error

Stack trace:

#0 /library/Zend/Soap/Client.php(1121): SoapClient->__soapCall('updateUser', Array, NULL, NULL, Array)

In my updateDoc class I have a standard doctrine update:

public function updateUser(){   $userEntity =

$this->em->getRepository("Application\Entities\Members")->findOneById(23); $userEntity->first_name = "updated firstname";
$this->em->persist($userEntity); $this->em->flush(); }

However if I call my getUser():

public function getUser()
{
    $userEntity = $this->em->getRepository("Application\Entities\Members")->findOneById(23);
    return $userEntity;
}

it works with no soap unknown error..

with the update, if remove $userEntity->first_name = "updated firstname";

it works, without any errrors but obviously, it doesnt update the entity... that entity has private properties too. not sure if it make a difference

UPDATE: also, i have just noticed, if i update the entity with the same values as its current ones, it works... e.g. the lastname = 'alison' , i update $entity->lastname = 'alison'... it works, but if i change it to a different last name it doesnt.. there is no doctrine error.... also, i can change this entity using the same function in any controller or model in the app

dean jase
  • 1,161
  • 5
  • 23
  • 38
  • This is not related to `Zend_Soap` but Doctrine2. SOAP client fails because the server fails too! You must find the Doctrine error (and paste it here if you want some help!) – Florent Oct 03 '12 at 16:10
  • No, because this function called 'updateUsers' works within any controller in the app... but when calling it from soap, it doesnt... – dean jase Oct 03 '12 at 16:13
  • also, i have just noticed, if i update the entity with the same values as its current ones, it works... e.g. the lastname = 'alison' , i update $entity->lastname = 'alison'... it works, but if i change it to a different last name it doesnt.. there is no doctrine error.... also, i can change this entity using the same function in any controller or model in the app – dean jase Oct 03 '12 at 16:15
  • i have tthis, i just found out...PHP Warning: spl_object_hash() expects parameter 1 to be object, boolean given in /private/library/Doctrine/ORM/UnitOfWork.php on line 2459 and PHP Warning: get_class() expects parameter 1 to be object, boolean given in /private/library/Doctrine/ORM/UnitOfWork.php on line 2459 – dean jase Oct 03 '12 at 16:57

1 Answers1

0

fixed...if using soap, theres no session, my user entity needed a valid session because it logs all updates..

dean jase
  • 1,161
  • 5
  • 23
  • 38