Extract ns:version from wsdl file using php?
I have attempted to extract an attribute from the paypal soap wsdl file using SimpleXml and DOM in php5 but they all skip over the root tag where the namespace declarations are.
It is not clear to me yet how to get a node referencing the root tag so that I can retrieve the value of ns:version using the current attributes function or array reference.
I need the version value for use in the c开发者_C百科lasses I dynamically generate from a wsdl file.
Thanks for any help provided.
[Edit] Solved it already, lol.
To access namespaced elements, you have to register the appropriate namespaces URIs. See
- http://www.php.net/manual/de/domdocument.getelementsbytagnamens.php and
- http://www.php.net/manual/de/domxpath.registernamespace.php
On a sidenote, there is a ready to use package called
- http://pear.php.net/package/Payment_PayPal_SOAP
and PHP has a native SOAP extension as well. Using SimpleXML or DOM is like low level access when you can have a convenient API for the PayPal API.
精彩评论