0

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:

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.

Community
  • 1
  • 1
denormalizer
  • 2,186
  • 3
  • 24
  • 36

1 Answers1

1

What I've had to do in the passed, and what you COULD do if you really wanted to spend your time on it is: make a wrapper class for the soapclient and pre-process the wsdls. e.g.

class SoapClientCompatibility extends SoapClient{

    public function __construct($wsdl, $options){
        // do things here, like:
        // download the wsdl using curl
        // modify/check it, then hand it over as the $wsdl to parent::__construct
    }

}
CobaltBlueDW
  • 510
  • 1
  • 5
  • 7