PHP client for asp.net webServices
Date: 01/26/06
(PHP Community) Keywords: php, web
Dear all,
I am not a major php programmer but need to connect a bit of php code
to my .net WebServices. I organized pretty much everything and it sort
of works. I am , though, having a problem with string[] that is
returned from the web services.
Basically, what I need is this:
connect to web service,
call a method (and pass params to it),
get the result.
it works. but the result is something I am having problems with. when it's a string or a number, it all works fine. when it is Array, ArrayList or string[] it's not working well for me.
I run a soap request with all the params that need to go with it and
the var_dump() for it will look like this:
$res = $client->GetSerialsPlainReq($params);
var_dump($res) :
object(stdClass)#5 (1) { ["GetSerialsPlainReqResult"]=>
object(stdClass)#4 (1) { ["string"]=> array(5) { [0]=> string(41)
"71ce347b-6780-4b91-95e1-462c24562bca" [1]=> string(41)
"eb26a8f3-5678-41b1-a55d-ca10c0775f55" [2]=> string(41)
"1c2c4e90-a3c8-47a2-9f31-41907f080f92" [3]=> string(41)
"cfbc4bdd-3371-4671-a8d2-f50b3807b020" [4]=> string(41)
"ba4e9628-0e55-4a0c-97f0-08e415cc3e5f" } } }
$xa = array($res->GetSerialsPlainReqResult);
var_dump($xa) :
array(1) { [0]=> object(stdClass)#4 (1) { ["string"]=> array(5) { [0]=>
string(41) "3ed8ed42-65b5-49ed-bb88-ebf5c1759f31" [1]=> string(41)
"609921ac-2360-46ad-a3df-c5a61a930a49" [2]=> string(41)
"609921ac-2360-46ad-a3df-c5a61a930a49" [3]=> string(41)
"609921ac-2360-46ad-a3df-c5a61a930a49" [4]=> string(41)
"609921ac-2360-46ad-a3df-c5a61a930a49" } } }
5 Guids - exactly what the web service needed to return.
What I can't do is "convert" the $res or $xa into something I will be
able to index with something like "foreach ($guid as $res){}" to print the
guids to the user.
Thanks for all of your answers.
P. S. Or, instead, shall I be returning something different then
string[] from my web services?
Source: http://community.livejournal.com/php/402460.html