If you’re writing or consuming webservices with PHP SOAP, it’s possible you run into the SOAP-ERROR: Parsing WSDL problem once.
The complete error string is:
SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://host/service?wsdl' : <specific error>
If you copy and paste the url (including the
?wsdl parameter) in the browser and you see the WSDL file, the problem lies in the fact that the PHP cannot reach the host.
When you connect to http://host/service, PHP fetches the XML from the WSDL page via fopen(‘http://host/service?wsdl‘) so it can use it to handle the request. In some cases, that request is not routed correct, resulting in the SOAP-ERROR.
- Add the hostname in the hostfile of the server (
- Add the hostname or IP address in the correct VirtualHost (
You can test the code by adding a file on the server:
<?php echo htmlentities(file_get_contents('http://host/service?wdsl'));
That way, you know if the server can reach and read the XML file.