Re: accessing the results returned from webservice

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

 



2009/1/7 Mansour Al Akeel <mansour.alakeel@gmail.com>:
> Hello all,
> I have been trying for the last few days to access the data returned from
> webservice. I am new to php, so be patient. Now, My understanding is the
> return from a _soapCall is an associative array. Which means I don't have to
> use xml or xpath to access the values. Insead, I can do something like:
>
> val = result['theNameOfTheRootTag']['aChildTag']
>
> I have been trying this but no luck. the documentation for this method is at
> http://php.net/function.soap-soapclient-soapcall and at the end of the page,
> there are some posts that address this issue. However, I have tried all of
> them and none worked for me. The format for the output is similar to:
>
> <response>
>   <custId>1</custId>
>   <authId>123</authId>
>   <authApproved>0</authApproved>
>   <custName>Someone</custName>
> </response>
>
> the code is like:
>
> results = **__soapCall ('getAuth' , $wsdl_url ) ;
>
> customer = $result['response']['custName'] ;
>
> This is not working. When I print this variable I get an empty value. Again,
> the docs says that it returns associative array in this case.
> Can anyone point me in the right direction ?
>
> Thank you in advance.
>
> **
>
> --
> PHP Soap Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

It is even easier than that!

Do a ...

print_r($results);

$results is the array of data, not a nested array of the XML.

so $result['custName'] is probably what you are after.


-- 
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"

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