Re: how to grab a list of objects from a soap response

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Milo van der Linden <milo@3dsite.nl> (Seg 03 Set 2007 16:02:00 WEST):

I also prefer not to parse the string for future compatibility with the php soap library..

I am one step further;

I now try:

Which gives me:
string(469) "<Projects><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>"

So at least the string only contains a Projects collection now.

I also noticed that thw WDSL definition does not contain a description of the content of the Response, it simply states "any"

Viewing this thread I the WSDL just return the XML with the result. So you have to parse the result. IMO you should use simplexml to parse the xml string. It's very simple to use.

$xml = new SimpleXMLElement($your_xml_string);

foreach ($xml->Project as $proj) {
  echo $proj->ID . "\n";
  echo $proj->Name . "\n";
  echo "-------------\n";
}

--
Carlos Pires

--
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux