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

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

 



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"

Might this be the problem?

Ammarmar schreef:
object(stdClass)#4 (1) {
   ["GetProjectListResult"]=&gt;
   object(stdClass)#5 (1) {
     ["any"]=&gt;
string(478) "<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>"
   }
}
Object id #5

Does this mean that I have to parse that string that contains the objects? And how should one do that?


Hmm, parsing is one solution, but generally, SOAPClient should be able to do it on its own and create objects/arrays.

I bet this empty namespace (xmlns="") is creating problems - check (if you have access) the server side and/or WSDL file for errors (especially 'types' part) - it shouldn't look like this.

Finally, if anything else fails, you may parse this xml using simplexml, DOM or whatever suits you, but I wouldn't start from it.

--
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