Re: Gensym, SOAP::Lite & Perl

From: Date: Fri, 21 Dec 2007 16:13:30 +0000
Subject: Re: Gensym, SOAP::Lite & Perl
References: 1  Groups: php.soap 
Request: Send a blank email to php-soap+get-2712@lists.php.net to get a copy of this message
When I receive back a response from the SOAP Server, the data is wrapped in gensym tags: ... <API_ExecuteResponse xmlns="http://server.co.uk/API"> <s-gensym1437 xsi:type="xsd:string"> remote_pass</s-gensym1437> <s-gensym1439 xsi:type="xsd:string"> *****</s-gensym1439> <s-gensym1441 xsi:type="xsd:string"> password</s-gensym1441> <s-gensym1443 xsi:type="xsd:string"> *****</s-gensym1443> <s-gensym1453 xsi:type="xsd:string"> error_string</s-gensym1453> <s-gensym1455 xsi:nil="true" /> </API_ExecuteResponse> ... In the Perl code, the above is handled internally, and it will create the key=>value pairs as an array. However, I can't get this to work in PHP.
PHP SoapClient should produce StdClass object with fields s-gensym1437, s-gensym1439, etc, e.g.: object(stdClass)#1 (2) { ["s-gensym1234"]=> string(3) "xyz" ["s-gensym1235"]=> string(3) "abc" } You should be able to iterate on this object using foreach. If you prefer working on arrays, you can do something like this: $gensym = array(); foreach ($result as $name => $value) { // if name contains "s-gensym" if (false !== strpos($name, "s-gensym")) { $gensym[] = $value; } } Resulting $gensym array will contain all string values sent as s-gensym****.

« previous php.soap (#2712) next »