开发者

PHP Magento SOAP-ERROR: Parsing WSDL: Couldn't load from urlpath

I am trying to create a soap client by passing a url that is hosted on my local machine, my dev environment and I keep getting this error. I use to be able to make this call and it worked just fine.

Basically all I am doing is this

$client = new SoapClient('http://virtual.website.com:81/api/?wsdl');

If I go to the url in a browser it comes up, so I know it is the right location. On the Magento forums there are some similar posts but I don't know that this is a Magento specific problem. Everything they mention as a solution I already have. They say to edit the hosts file for example 127.0.0.1 website.com

I already hav开发者_如何转开发e this since it is setup as a virtual host.

Here is the error in my error_log

[Fri Jun 04 12:30:37 2010] [error] [client 127.0.0.1] PHP Fatal error:  SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://virtual.website.com:81/api/soap/?wsdl' : XML declaration allowed only at the start of the document\n in /usr/local/sites/virtual.website.com/www/CUSTOMSCRIPTS/removeProductImages.php on line 6
[Fri Jun 04 12:30:37 2010] [error] [client 127.0.0.1] PHP Stack trace:
[Fri Jun 04 12:30:37 2010] [error] [client 127.0.0.1] PHP   1. {main}() /usr/local/sites/virtual.website.com/www/CUSTOMSCRIPTS/removeProductImages.php:0
[Fri Jun 04 12:30:37 2010] [error] [client 127.0.0.1] PHP   2. SoapClient->SoapClient(*uninitialized*) /usr/local/sites/virtual.website.com/www/CUSTOMSCRIPTS/removeProductImages.php:6

UPDATE:: I have found that this isn't an issue with SOAP something is adding extra spaces to my XML file.


I had exactly the same problem. I had installed Zend Server (PHP 5.3.9) and was getting the same error. I searched a lot and applied all available solutions but all failed. Finally, I installed wamp and then run 'Soap Client' script over there and it runs successfully.

Then I reached on this point that Zend Server (PHP 5.3.9) has some default bug in 'Soap Client' Script. I uninstalled Zend Server (PHP 5.3.9) and installed Zend Server (PHP 5.4.11) and runs 'Soap Client' script over there. This time it runs successfully.

Conclusion: Please use latest PHP version (Zend Server) or (Wamp Server) as, there is default 'Soap Client' bug in some PHP versions, one I mentioned above.


After changing URL settings of Magento or your local environment you should always clear Magento /var/cache/ directory. Usually all weird errors disappear with it.


The answer seemed to be for us that we had not enabled the xmlrpc PHP extension. Once we did that the error went away.


Also the problem could be related to rights on soap.wsdl_cache_dir directory


I solved this on my WAMP setup by enabling the php_openssl extension, since the URL I was loading from used https://.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜