Re: Gensym, SOAP::Lite & Perl

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

 




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

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