wsdl2php
Welcome to wsdl2php!
This page is intended to inform about updates and current status.
1. Download the first version here (Linux only)
2. Run ./configure, make
3. Type wsdl2php -h
wsdl2php Version 0.0.1 (c) 2006 Manfred Weber
Usage: ./wsdl2php [-h] [-V] [-v] [-D] [-o ] [-s ] [-n ] [-w ] ...
-h : Print this help and exit
-V : Print version and exit
-v : See what the tool is generating as it is generating it.
-D : Print debug information
-o : Override the root directory for all emitted files
-w : URL or filename of wsdl
-s : Override Schema Namespace
-n : Override Service Namespace
-f : Override Filetype Suffix - Default is .php
-x : Register new xsl Template set - Default is php5
Here is a short example using the GoogleSearch Api:
./wsdl2php -w http://api.google.com/GoogleSearch.wsdl
This will create all the DataTypes and the Service Files in the targetNamespace which is defined by google.
The result should look like this:
GoogleSearch/
|-- DirectoryCategory.php
|-- DirectoryCategoryArray.php
|-- GoogleSearchResult.php
|-- GoogleSearchService.php
|-- ResultElement.php
|-- ResultElementArray.php
`-- port
`-- GoogleSearchPort.php
Now why is there an extra file created "GoogleSearchPort.php" ?
wsdl2php creates for each portType a seperate layer which you can use with a factory.
-
include_once("GoogleSearchService.php");
-
$service = GoogleSearchService::factory("GoogleSearchPort");
-
$result = $service->doGoogleSearch( $key, $q, $start, $maxResults, $filter, $restrict, $safeSearch, $lr, $ie, $oe );
Due to the possibility of wsdl to support different kinds of porttypes, the service is called with a factory where the 1.param holds the implementation of the port. The GoogleSearch Api uses Soap, so GoogleSearchPort.php holds the php soap implementation.
-
$service = GoogleSearchService::factory("GoogleSearchPort", $options);
You can optionally pass a 2.nd parameter which holds the options for the portType implementation.
-- Manfred

