note 110402 modified in soapclient.soapcall by danbrown

From: Date: Thu, 06 Dec 2012 14:42:57 +0000
Subject: note 110402 modified in soapclient.soapcall by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-192350@lists.php.net to get a copy of this message
If you're using a custom class object as a parameter (or nested within your parameters), and you store your data in a $_data[] attribute variable, you need to implement the __get($key) method in that custom class, or your data won't translate/convert into the XML. <?php class ColorParam { private $_data = array(); public function __get($key) { return $this->_data[$key]; } public function setBackground($data) { $this->_data['background'] = $data; } } $client = new SoapClient($wsdl); $colorParam= new ColorParam(); $colorParam->setBackground('blue'); $client->sampleImageCall($colorParam); ?> --was-- If you're using a custom class object as a parameter (or nested within your parameters), and you store your data in a $_data[] attribute variable, you need to implement the __get($key) method in that custom class, or your data won't translate/convert into the XML. class ColorParam { private $_data = array(); public function __get($key) { return $this->_data[$key]; } public function setBackground($data) { $this->_data['background'] = $data; } } $client = new SoapClient($wsdl); $colorParam= new ColorParam(); $colorParam->setBackground('blue'); $client->sampleImageCall($colorParam); http://php.net/manual/en/soapclient.soapcall.php

« previous php.notes (#192350) next »