开发者

PHP SoapClient: Problems with Distributed WSDL File

I have a problem using a distributed WSDL File (scheme / other definitions are declared outside the actual WSDL) with PHP's SoapClient.

This is the fault message I got:

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

After some googling, it seems to be a bug inside PHP as someone else discovered exactly the same problem: http://bugs.php.net/bug.php?id=45282

Has there been any bug fix(es)? Any solution to work 开发者_JAVA技巧around this bug?

I think posting a code snippet is senseless, since the invocation of the SoapClient ctor using just the WSDL is the only that fails.


I had same issue. The problem was in wsdl and imports, I saved wsdl from site and pointed soapclient to use local file, but all references were original. Soap client each time gets file from remote host, went to parts, and from them back to same file but on remote drive. That caused same file to be loaded twice. Solution is to use only remote files or to rewrite paths to local (all). SoapUI does that when you hit "export definitions" on project wsdl. Hope that will help others.


Download a local copy of the WSDL file. Remove duplicate method names. Update your soap client to use the local WSDL file. This has worked well for me in the past.


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


The PHP source code (svn) which takes care of the import nodes contains the comment /* TODO: namespace ??? */. Namespaces are ignored which enables the method collisions to occur.

Three solutions are proposed:

  1. Fix the source code to cater for namespaces (which would be very welcome)
  2. Manipulate the WSDL files to prevent such method overlaps (this is likely not an option at all)
  3. Instead of using the original WSDL file, call the imported ones individually (or group ones which do not have method name collisions) with separate SoapClient instances.

Sorry that I can't be of more help.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜