Re: [SOAP] Class Question

From: Date: Mon, 03 Jun 2002 06:08:58 +0000
Subject: Re: [SOAP] Class Question
References: 1  Groups: php.soap 
Request: Send a blank email to php-soap+get-45@lists.php.net to get a copy of this message
--- Javier Szyszlican <php@szysz.com> wrote: > Hi, > > I'm trying some things with phpsoap, but I cant get classes to work when they > > are one inside another. > > Server: > class interfaces_class { > function get() { return "hi"; } > } > > class jffnms { > var $interfaces; > > function jffnms() { > $this->interfaces = new interfaces_class(); > } > } > > $server = new SoapServer("urn:jffnms"); > $server->setClass('jffnms'); > $server->setPersistence(SOAP_PERSISTENCE_SESSION); > $server->handle(); > > Client: > > $obj = new SoapObject > ("http://server/soapserver.php","urn:jffnms"); > $aux = $obj->interfaces->get(); > var_dump($aux); > > > I'm geting : > Call to a member function on a non-objectSOAP-ENV:Server > > > In normal php I use: > > $obj = new jffnms(); > echo $obj->interfaces->get(); > > > What I'm missing? > Is there any other way to do it? Yeah this won't work... currently phpsoap doesn't handle attributes of soapobjects.. meaning $obj = new SoapObject("blah.wsdl"); $obj->some_member = "blah"; // this won't do anything with the server. // so that means $obj->some_member->blah(); // doesn't do anything with the server ither.. // you are pretty much just accesing the 'local' some_member not the server one. what you can do is have wrapper functions in your server object. class interfaces_class { function get() { return "hi"; } } class jffnms { var $interfaces; function jffnms() { $this->interfaces = new interfaces_class(); } function get() { return $this->interfaces->get(); } } - Brad __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com

« previous php.soap (#45) next »