Re: accessing the results returned from webservice

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

 



Hello Richard,
Thank you for your reply. Unforetunately this didn't work for me. all I
get is the xml braket "<" when I try to evaluate a value. The issue here
is that I am trying to modify the code to a plugin that doesn't print
directly to screen, however, it has a logging mechanism and I can use
this to view the variables. I use $vmLogger->() or similar funcitons to
output what I need to view. When I do $vmLogger->err($results), I get
the xml I am expecting printed out. But when I try to evaluate each node
and extract the data, I get the bracket "<". Now, I don't understand why am I getting
this ? And what is the way around ? what am I doing wrong ? 

to correct the code I posted, I am using : 

result = $client->__soupCall('getAuth' , $wsdl_url) ; 
print_r($result); 
customer = $result['custName'] ; 

Thank you in advance.


On Wed, Jan 07, 2009 at 05:45:13PM +0000, Richard Quadling wrote:
> 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