I'd like to get the text from the <Version>
element which is nested inside the <service>
block of a WSDL. The WSDL in question is Ebay's Trading api. The snippet in question looks something like this:
<wsdl:service name="eBayAPIInterfaceService">
<wsdl:documentation>
<Version>941</Version>
</wsdl:documentation>
<wsdl:port binding="ns:eBayAPISoapBinding" name="eBayAPI">
<wsdlsoap:address location="https://api.ebay.com/wsapi"/>
</wsdl:port>
</wsdl:service>
I'm currently doing this:
$xml = new DOMDocument();
$xml->load($this->wsdl);
$version = $xml->getElementsByTagName('Version')->item(0)->nodeValue;
This works but I'm wondering if there is a method to get this natively using PHP's SOAP extension?
I was thinking something like the following would work but it doesn't:
$client = new SoapClient($this->wsdl);
$version = $client->eBayAPIInterfaceService->Version;
<service>
. The wsdl is publicly available here developer.ebay.com/webservices/latest/ebaysvc.wsdl. If you can provide a working example using SoapClient that would be very helpful. – Jarib$xml->getElementsByTagName('Version')->item(0)->nodeValue;
– Jarib$version = $client->service->documentation->version;
but I advise you to go in debugging mode and see the exactly structure there. – Placentation