This document should contain all you need to know on how to use wsdl2php.
wsdl2php can be a handy tool to auto generate PHP code from a WSDL-file.
In order to use wsdl2php you need to satisfy the following requirements:
You need to have a php-cli version of PHP 5 compiled with:
- soap - SOAP extension
- dom - DOM extension
- spl - Standard PHP Library
NOTE: 0.1 is only working on *NIX systems.
Download the latest release from http://sourceforge.net/projects/wsdl2php. Then install the package with the PEAR-installer.
sudo pear install wsdl2php-0.2.1-pear.tgz
No configuration is needed at this stage.
Using wsdl2php is as simple as type
wsdl followed by your URL or path to your WSDL-file.
Here goes a very basic example. Let's try out a simple webservice called "Hello Translated" found on XMethods.net. Create a working directory and type:
Then you'll get a PHP file called
HelloLangService.php which is the webservice communication class.
Now create a file called
hello.php in the same directory with this code:
$hello = new HelloLangService();
print ucfirst($hello->sayHello('Japanese')).' '.ucfirst(`whoami`);
Save if and execute it with:
Now you should get a friendly message in Japanese :) Good luck!