Forum Moderators: coopster
Using the classmap parameter, my Class object is getting encoded properly, but my Section and Session objects are getting wrapped within <SOAP-ENC:Struct> instead of <section> and <session> respectively.
I'm very new to PHP SOAP, so I could use any help.
Thanks.
But it has a work around, visit manual SOAP [php.net] and then search for "NODKZ" comments. He has shown the work around.
here is a snippet of class
abstract class SOAPable {
public function getAsSOAP() {
foreach($this as $key=>&$value) {
$this->prepareSOAPrecursive($this->$key);
}
return $this;
}
private function prepareSOAPrecursive(&$element) {
if(is_array($element)) {
foreach($element as $key=>&$val) {
$this->prepareSOAPrecursive($val);
}
$element=new SoapVar($element,SOAP_ENC_ARRAY);
}elseif(is_object($element)) {
if($element instanceof SOAPable) {
$element->getAsSOAP();
}
$element=new SoapVar($element,SOAP_ENC_OBJECT);
}
}
}