I am trying to create a soap client by passing a URL that is hosted on my local machine in my dev environment, and I keep getting this error. I use this call and it worked fine.
Basically all I do is
$ client = new SoapClient (' http://virtual.website.com:81/api/?wsdl ');
If I go to the URL in the browser it will appear, so I know this is the right place. There are several similar posts on the Magento forums, but I don't know that this is a Magento problem. Everything that they mention is like a solution that I already have. They say to edit the hosts file, for example 127.0.0.1 website.com
I already have this since it is configured 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 found that this is not a problem with SOAP, something adds extra spaces to my XML file.
source share