note 97151 deleted from simplexmlelement.construct by danbrown
| From: | danbrown@php.net | Date: | Sun, 04 Apr 2010 23:43:21 +0000 |
| Subject: | note 97151 deleted from simplexmlelement.construct by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-167703@lists.php.net to get a copy of this message | ||
Note Submitter: uramihsayibok, gmail, com
----
@zwilson (19-Nov-2009)
I haven't seen SimpleXML have any problems with SOAP. The issue is whether you know how to
properly deal with the result. Yes, namespaces in SimpleXML aren't terribly simple (a
->{"soap:Envelope"} syntax would be wonderful) but they're certainly manageable.
Using W3School's example SOAP response* (http://www.w3schools.com/SOAP/soap_example.asp):
<?php
$xml = new SimpleXMLElement("...", 0, false);
define("NS_M", "http://www.example.org/stock");
define("NS_SOAP", "http://www.w3.org/2001/12/soap-envelope");
// the price
echo (string)$xml
->children(NS_SOAP)->Body
->children(NS_M)->GetStockPriceResponse
->Price;
?>
Why deform the response when you can just deal with it?
(* Not posted because it doesn't pass the spam filter)