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

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP

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 have 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 documentn 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.



This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.





The error message is not very detailed... could you put your code snippet in a try/catch structure, where you would var_dump the thrown Exception, just to see if there are more details? I don't know if all the fields in this constructor fr2.php.net/manual/en/soapfault.soapfault.php are visible in the error message you get.
– greg0ire
Jun 5 '10 at 10:54





I tried that but it doesn't seem to catch it. I found that weird. Another thing. I had my co-worker try it out on the same project on their local machine and it worked. It makes me think there is something weird going on in my local machine.
– dan.codes
Jun 5 '10 at 13:36





It isn't caught because it is a Fatal error. Which is a bug : look here bugs.php.net/bug.php?id=34657 But there is something interesting in your error message : 'XML declaration allowed only at the start of the document' I think there must be something unintended before it, try to get your page with wget and look at your code with vi, to see if there are extra characters before this XML declaration.
– greg0ire
Jun 5 '10 at 13:52





hmm there are spaces when doing that, but this file should be the same as any other file that the other co-worker has and it worked for them
– dan.codes
Jun 6 '10 at 1:01





Another thing, the actual xml file that is in the code, the xml declaration is on line 1, what might add space there.
– dan.codes
Jun 6 '10 at 1:08




5 Answers
5



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


soap.wsdl_cache_dir





This is really a comment, not an answer. With a bit more rep, you will be able to post comments.
– Emil
Oct 26 '12 at 22:14



I'm late but hope my reply will be useful for someone in future.



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 fails....
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.



Thanks,
Kashif



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






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

Executable numpy error

Trying to Print Gridster Items to PDF without overlapping contents

Hystrix command on request collapser fallback