PHP Classes
elePHPant
Icontem

WSDL To PHP: Generate classes to send SOAP requests from a WSDL

Recommend this page to a friend!

  Author Author  
Name: WsdlToPhp <contact>
Classes: 8 packages by
Country: France France
Age: 33
All time rank: 95333 in France France
Week rank: 26 Up2 in France France Up
Innovation award
Innovation award
Nominee: 4x

Winner: 1x


  Detailed description   Download Download .zip .tar.gz   Install with Composer Install with Composer  
This class can generate classes to send SOAP requests from a WSDL.

It retrieves a WSDL (Web Services Definition Language) from a given URL and generates classes to send SOAP requests to the functions exposed by the specified SOAP server.

The class generates either the classes to send the actual SOAP requests, as well the classes to compose the request parameters and process the request responses.

It uses ezcPhpGenerator component of the eZ Components framework to generate the PHP code files.

Details
{startverticalbanner}
# Warning
This project is not intended to be improved/enhanced anymore. It is kept in his original state for those who use it as it is.
From now, please look at https://github.com/WsdlToPhp/PackageGenerator to get the refactored and improved version of this project which is evoluting.

# WsdlToPhpGenerator
Generate PHP classes based on a WSDL

This package allows to programmatically send request to a SOAP service using PHP classes. In order to do that, this class generates each class for each request and each request parameters and each request response. Each class is stored in a hierarchical folder/sub-folder system. The SOAP client is then abstracted and you only deal with objects representing the WSDL types.

Generated classes are fully documented with php doc block according to phpDocumentor. It retrieves the documentation tags from the WSDL and its schemas and defines used methods, return type, parameter type, etc.

Test this library online here : http://www.wsdltophp.com/

Read the PHPDoc online here : http://phpdoc.wsdltophp.com/

[![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KXBVCHP3UDQPL)

# Tutorial
The best way to understand how to use this code is to first look at the samples-generator.php file located in the root directory.
This file shows you how to basically instanciate the WsdlToPhpGenerator class. This class has options in order to change its behaviour.

Lets have a look to see how to use it basically:
```php
/* Create an instance of the generator with the WSDL from which to generate the package */
$w = new WsdlToPhpGenerator('https://www.paypalobjects.com/wsdl/PayPalSvc.wsdl');
/* Call after the instanciation or before a new generation in order the modify the generator behaviour */
// Activate the autoload file generation
WsdlToPhpGenerator::setOptionGenerateAutoloadFile(true);
// Activate the generation and the use of the generic WsdlClass from which each generated class will inherit
WsdlToPhpGenerator::setOptionGenerateWsdlClassFile(true);
// Allows to get the SOAP response as a parameter of the generated PHP response class or not
// It depends on the SOAP Web service, some returns the Response object, others return the the data of the response object
WsdlToPhpGenerator::setOptionResponseAsWsdlObject(false);
// Very usefull if you're not familiartr with SOAP, it generates a sample file that contains all the possible
// methods provided by the SOAP Web service and first parameters level
WsdlToPhpGenerator::setOptionGenerateTutorialFile(true);
// Depending on the SOAP Web service, you may have to send an array, mySoapMethod(array('param_1'=>'value_1','param_2'=>'value_2')),
// or send parameters as the method parameters, mySoapMethod('value_1','value_2')
WsdlToPhpGenerator::setOptionSendArrayAsParameter(true);
// Used for certain SOAP Web service such as certain Microsoft Application Web service, you may have to send the parameter as
// mySoapMethod(array('parameters'=>array('param_1'=>'value_1','param_2'=>'value_2')))->parameters and get the response in the parameters response property
WsdlToPhpGenerator::setOptionSendParametersAsArray(false);
// Depending on your preferences, classes are generated under folders according to their name. The name is splitted at each upper character
// so each classes is contained by folders or not if you choose WsdlToPhpGenerator::OPT_CAT_NONE_NAME
WsdlToPhpGenerator::setOptionCategory(WsdlToPhpGenerator::OPT_CAT_START_NAME);
// Depending on your preferences, classes are generated under subfolders according to their name. The name is splitted at each upper character
// so each classes is contained by sub folders or not if you choose WsdlToPhpGenerator::OPT_SUB_CAT_NONE_NAME
WsdlToPhpGenerator::setOptionSubCategory(WsdlToPhpGenerator::OPT_SUB_CAT_END_NAME);
// Depending on your preferences, SOAP operations are gathered in mutliple classes as methods according to their name. The name is splitted at each upper character
// so each operation is contained by classes named with the start of the operation name (WsdlToPhpGenerator::OPT_GATH_METH_START_NAME) or the end (WsdlToPhpGenerator::OPT_GATH_METH_END_NAME)
WsdlToPhpGenerator::setOptionGatherMethods(WsdlToPhpGenerator::OPT_GATH_METH_START_NAME);
// Add comment to each generated file to retrieve them in the PHP Documentation
WsdlToPhpGenerator::setOptionAddComments(array(
													'date'=>date('Y-m-d'),
													'author'=>'Mikaƫl DELSOL',
													'version'=>1));
// Launch the generation indicating the name to use to generated the classes and the destination directory
$w->generateClasses('PayPal',dirname(__FILE__) . '/PayPal/');
// After the generation, you can analyse the audit data collected during the generation by calling the method getAudit() as below
// It returns an array with lots of informations about time spent at each generation step
print_r($w->getAudit());
```

Feel free to make request for improvements.

  Classes of WsdlToPhp  >  WSDL To PHP  >  Download Download .zip .tar.gz  >  Support forum Support forum (2)  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: WSDL To PHP
Base name: wsdl-to-php
Description: Generate classes to send SOAP requests from a WSDL
Version: 7
PHP version: 5.3
License: GNU General Public License (GPL)
All time users: 2126 users
All time rank: 1806
Week users: 1 user
Week rank: 604 Up
 
  Groups   Rate classes User ratings   Applications   Related pages   Files Files  

  Groups  
Group folder image PHP 5 Classes using PHP 5 specific features View top rated classes
Group folder image Web services Web data clipping, SOAP or XML-RPC clients and servers View top rated classes
Group folder image Code Generation Compilers and tools that generate code automatically View top rated classes


  Recommendations  

Web Services API Using SOAP XML WSDL
API Integration using SOAP XML WSDL

connect to wsdl
connect to wsdl and get the xml parsed


  User ratings  
Not enough user ratings

  Applications that use this package  
WSDL to php
Website that hosts the classes and uses them to generate the package online so the uers can download the generated package zipped.

Add link image If you know an application of this package, send a message to the author to add a link here.


  Related pages  
Github
Complete and up to date package on Github
Google Code
Complete and up to date package on Google Code
PHP Doc
The PHPDocumentor generated PHP Doc of the library
Sourceforge
Complete and up to date package on Sourceforge
WSDL to php
Online tool to test this library

  Files folder image Files  
File Role Description
Files folder imagesamples (2 files)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENCE.md Doc. License
Accessible without login Plain text file README.md Data Auxiliary data
Accessible without login Plain text file sample-tpl.php Example Class source
Accessible without login Plain text file samples-generator.php Example Class source
Accessible without login Plain text file samples.php Example Example script
Plain text file WsdlClassFileTpl.php Class Class source
Plain text file WsdlToPhp Class Class source
Plain text file WsdlToPhp.php Class Class source
Plain text file WsdlToPhpFunction.php Class Class source
Plain text file WsdlToPhpGenerator.php Class Class source
Plain text file WsdlToPhpModel.php Class Class source
Plain text file WsdlToPhpService.php Class Class source
Plain text file WsdlToPhpStruct.php Class Class source
Plain text file WsdlToPhpStructAttribute.php Class Class source
Plain text file WsdlToPhpStructValue.php Class Class source

  Files folder image Files  /  samples  
File Role Description
  Accessible without login Plain text file README.md Data Auxiliary data
  Accessible without login Plain text file readme.txt Doc. Documentation

Install with Composer Install with Composer - Download Download all files: wsdl-to-php.tar.gz wsdl-to-php.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.