how to grab a list of objects from a soap response

From: Date: Mon, 03 Sep 2007 10:19:55 +0000
Subject: how to grab a list of objects from a soap response
Groups: php.soap 
Request: Send a blank email to php-soap+get-2626@lists.php.net to get a copy of this message
Hello soapers! Thanks to a lot of help here on the forum, I now have the .net webserver attached to my php soap client. The response I now get from the server is a list of projects as described in the raw result here under: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body> <GetProjectListResponse xmlns="http://www.itworks.nl/"> <GetProjectListResult> <Projects xmlns=""> <Project><ID>1</ID><Name>LOGIS_2007-1</Name></Project> <Project><ID>2</ID><Name>LOGIS_2007-2</Name></Project> <Project><ID>3</ID><Name>LOGIS_2007-3-1</Name></Project> <Project><ID>4</ID><Name>LOGIS_2007-4</Name></Project> <Project><ID>5</ID><Name>LOGIS_2007-5</Name></Project> <Project><ID>6</ID><Name>LOGIS_2007-6</Name></Project> <Project><ID>7</ID><Name>MWI_TEST_LOCATIEVELD</Name></Project> <Project><ID>8</ID><Name>MWI_TEST_LOCATIE_2</Name></Project> </Projects> </GetProjectListResult> </GetProjectListResponse> </soap:Body></soap:Envelope> I want to loop through the Projects, but I cannot seem to get them! The loop I have is: foreach ($result->GetProjectListResult->Projects->Project as $soapVar) { echo $soapVar->Name; } But this keeps giving me the error: Notice: Undefined property: stdClass::$Projects in C:\wamp\www\wsSoilution.php on line 55 Notice: Trying to get property of non-object in C:\wamp\www\wsSoilution.php on line 55 Any suggestions? Thanks! Milo van der Linden

« previous php.soap (#2626) next »