I have a WSDL located somewhere similar to this:
https://provider.web-service.domain/path/ServiceName?wsdl
It has a line like this:
<wsdl:import namespace="http://name/space/service/" location="ServiceName.wsdl"></wsdl:import>
ie. It is trying to import another wsdl at the location:
https://provider.web-service.domain/path/ServiceName.wsdl
So when initialising the SoapClient, I get the following error:
PHP Fatal error: SOAP-ERROR: Parsing WSDL:
Couldn't load from 'https://provider.web-service.domain/path/ServiceName.wsdl' :
failed to load external entity "https://provider.web-service.domain/path/ServiceName.wsdl"
I'm trying to resolve this issue with my WSDL provider at the moment, but is there a workaround for this issue?
I'm guessing the only resolution is for them to provide a path that actually points to an accessible resource. And that in fact there isn't much I can do about it.
Your thoughts.
Related:
- php SoapClient fails when passed a wsdl with relative path schemas
- https://issues.apache.org/jira/browse/AXIS2-484
UPDATE
Provider says PHP SOAP Client SUX (Essentially).
Changed title from:
- php SoapClient: Couldn't Load from external entity; to
- php SoapClient: Couldn't Load from external entity (Where endpoint resolves to another location)
So PHP SoapClient doesn't know that the url to the wsdl is resolving to another location so it tries to import the file from the original location.
Since the resource does not exist at the original location it throws an error.
As a workaround, they have provided the WSDL so we can put on our server.
But this problem needs a better resolution.
UPDATE 2
I would like to reword the question for clarity:
I've been asked to use the following WSDL URL:
[1] https://provider.web-service.domain/path/ServiceName?wsdl
There are two WSDLs at the following location
[2] https://provider.web-service.domain/path/ServiceName/another/diff/path/prefix_ServiceName.wsdl
[3] https://provider.web-service.domain/path/ServiceName/another/diff/path/ServiceName.wsdl
- [1] resolves to [2]; Then
- [2] imports [3]
When passing [1] into SoapClient(), it FATALs (as described earlier)
When passing [2] into SoapClient(), it works.