问题
Bit of a curly one I can't work out (I've not used SOAP an awful lot).
I have a WDSL web service I need to consume: https://gist.github.com/aleayr/0dc4f26b0b9dd6ba7dae
But PHP is throwing a Fatal error when trying to consume it, saying
PHP Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't find <definitions> in 'http://path/to/ServiceManager.svc?wsdl' in C:\path\to\submit.php on line 37
I note the actual XML tag has a wdsl namespace in front of it, is there any way to get PHP to recognise this?
回答1:
I've the same error. This must be caused because there's no definition of the Action-URI. I've worked out like this:
public function testSOAPService()
{
$soap_action = "http://tempuri.org/XXXsomething/ActualURI";
$service = new SoapClient($this->wsdl); //WSDL defined before
$service->__setLocation($soap_action);
return $service->__getFunctions(); //you must see the functions of that service
}
At least for me this worked fine. Source SoapClient::__setLocation
来源:https://stackoverflow.com/questions/25398193/php-soap-error-couldnt-find-definitions