PHP SoapClient: Problems with Distributed WSDL File

I have a problem using a distributed WSDL file (schemas / other definitions declared outside the real WSDL) using PHP SoapClient.

This is the error message I received:

SOAP-ERROR: Parsing WSDL: 'getSomeInfo' already defined. 

After some googling, this seems like a bug inside PHP, as someone else has found the exact same problem: http://bugs.php.net/bug.php?id=45282

Have any bugs been fixed? Any solution to solve this problem?

I think posting a piece of code is pointless, since calling SoapClient ctor using only WSDL is the only one that fails.

+4
source share
4 answers

I had the same problem. The problem was wsdl and import, I saved wsdl from the site and indicated soapclient to use the local file, but all the links were original. The Soap client each time receives a file from a remote host, is sent to parts and back back to the same file, but to a remote drive. This caused the same file to be downloaded twice. The solution is to use only deleted files or rewrite local paths (all). SoapUI does this when you click on “export definitions” in a wsdl project. Hope this helps others.

+1
source

The PHP ( svn ) source code that takes care of the import nodes contains the comment /* TODO: namespace ??? */ /* TODO: namespace ??? */ . Namespaces are ignored, causing a method collision.

Three solutions are proposed:

  • Fix source code for serving namespaces (which would be very welcome)
  • Manipulate WSDL files to prevent overlapping of such methods (this is most likely not an option)
  • Instead of using the original WSDL file, call the imported ones separately (or group those that have no method name conflicts) with individual SoapClient instances.

Sorry I can't help anymore.

0
source

Download a local copy of the WSDL file. Remove duplicate method names. Update your click to use the local WSDL file. It worked well for me in the past.

0
source

I had the same issue when accessing a WCF service providing multiple endpoints via PHP. In my case, it turned out that the main WSDL imports sub-WSDL for each endpoint, while the sub-WSDL include in turn the main WSDL. This is apparently the reason why PHP reads the main WSDL twice and comes up with an "already defined" -error. I could avoid this behavior by creating a client with the sub-WSDL URL of the desired endpoint instead of the main WSDL URL.

0
source

Source: https://habr.com/ru/post/1302493/


All Articles