2008年11月25日星期二

RE: [fw-webservices] Read the contents of an xml

Hi,

 

If you use getLastResponse(), you will have a string in $response.

 

You have to load this string in a DOMDocument object. You can then either do $domdocument->getElementsByTagName(‘return’), or if it’s a more complex return document, you can create a DOMXpath object to query the DOMDocument. You can then use XPath to query for the node you need.

 

Another possibility is to use:

 

$response  = $myzendsoapclient->callMethod($parameters);

 

Now – if you use a classmap in the Zend_Soap_Client –$response will be an object as defined in the WSDL file of the soap server. Of course you need every complex object in the WSDL schema in your classmap.

 

If you don’t use a classmap, this will be a StdClass object. You should be able to navigate through this object like this:

$returnvalue = $response->someNode->return; (or wherever the return node is)

 

Regards,

Dieter

 

From: Jigal sanders [mailto:jigalroecha@gmail.com]
Sent: dinsdag 25 november 2008 13:37
To: fw-webservices@lists.zend.com
Subject: [fw-webservices] Read the contents of an xml

 

Hello everyone.

I use Zend_Soap_Client to comunicate with a webservice.

I have $response = $this->client->getlastResponse();
This gives me an xml file with the response. How can i read a node from this file?
How can I get the contents of the node <return>123</return>?

Thanks in advance

jsanders

No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.175 / Virus Database: 270.9.9/1808 - Release Date: 24/11/2008 14:36

没有评论: