PHP SOAP Error - Couldn't find <definitions>

不打扰是莪最后的温柔 提交于 2019-12-25 07:12:12

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!