viernes, 27 de enero de 2017

Error de SOAP: couldn't load from file: failed to load external entity


SOAP-ERROR: Parsing WSDL: Couldn't load from 'file:/path/file.wsdl' : failed to load external entity "file:/path/file.wsdl"
En Debian jessy (8), hay un error al llamar un documento WSDL del lado servidor en PHP que vincule a otro documento WSDL con el tag “import”. Por ejemplo:
Sin embargo, esto no sucede en Centos 6.5 por ejemplo. En la especificación de WSDL 1.1 https://www.w3.org/TR/wsdl dice:
 
...
2.1.1 Document Naming and Linking
WSDL documents can be assigned an optional name attribute of type NCNAME that serves as a lightweight form of documentation. Optionally, a targetNamespace attribute of type URI may be specified. The URI MUST NOT be a relative URI.
WSDL allows associating a namespace with a document location using an import statement:
<pre class="western"><definitions ....=""> </definitions></pre>
...
En este caso, para Centos funciona, pero para Debian no.
Mi solución fue del lado servidor cambiar el llamado al WSDL de archivo a una url HTTP:
asi se llamaba:
file://ruta/file.wsdl
y asi se llama ahora
http://localhost/ruta/file.wsdl.
Espero les sirva el tip.