Re: accessing the results returned from webservice
Ok, I am trying to call a webservice that is implemented in .NET. I
didn't realize it's different ! I though webservices should all be the
same !! I checked the return type with gettype and it's string. I
modified the code to call the WS using:
result = $client->myFunction($param) ;
I will try to extract the data I need using regex. I know this is
stupid, but I don't have another options for now. Unless someone
suggests a better way.
I will report the results in either cases.
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
[PHP Home]
[PHP Users]
[Kernel Newbies]
[PHP Database]
[Yosemite]