How to generate a PHP soap client code?

Meidan Alon picture Meidan Alon · Nov 1, 2009 · Viewed 43.3k times · Source

Is there a way to generate a PHP Soap Client from a WSDL file?

I mean something like wsdl.exe or svcutil.exe in .net, that generates code for a class that can be the client of a service, not something like:

$WSDL     = new SOAP_WSDL($wsdl_url); 
$client   = $WSDL->getProxy(); 

My problem is that I want the PHP client to be able the work with a service, even when that service doesn't expose its WSDL.

Answer

aqm picture aqm · Apr 8, 2014

I found generator really useful

https://github.com/wsdl2phpgenerator/wsdl2phpgenerator

Instructions (from github) :

  • Download wsdl2phpgenerator-2.3.0.phar from the latest release
  • Run "php wsdl2phpgenerator-2.3.0.phar -i input.wsdl -o tmp/my/directory/wsdl"

Work for web hosted wsdl too

eg

php wsdl2phpgenerator-2.3.0.phar -i http://someurl/input.wsdl -o tmp/my/directory/wsdl