2017 © Pedro Peláez
 

library wsdl2phpgenerator

Simple class library for generating php classes from a wsdl file.

image

dhcmediway/wsdl2phpgenerator

Simple class library for generating php classes from a wsdl file.

  • Monday, May 28, 2018
  • by DHCMediWay
  • Repository
  • 0 Watchers
  • 0 Stars
  • 52 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 222 Forks
  • 0 Open issues
  • 37 Versions
  • 18 % Grown

The README.md

Installation

Add wsdl2phpgenerator to your Composer project:, (*1)

composer require dhcmediway/wsdl2phpgenerator

The project will also be available as a command line application which can be downloaded as a phar file., (*2)

Usage

To generate classes create a Generator instance and pass it a Config instance., (*3)

$generator = new \Wsdl2PhpGenerator\Generator();
$generator->generate(
    new \Wsdl2PhpGenerator\Config(array(
        'inputFile' => 'input.wsdl',
        'outputDir' => '/tmp/output'
    ))
);

After generating the code then configure your existing autoloader accordingly. The generated code also comes with a simple autoload.php file which can be included directly. This registers a simple autoloader for the generated classes., (*4)

Example usage

The following example will generate code from a web service, load the generated classes, call the web service and return the result over the course of a single process., (*5)

$generator = new \Wsdl2PhpGenerator\Generator();
$generator->generate(
    new \Wsdl2PhpGenerator\Config(array(
        'inputFile' => 'http://www.webservicex.net/CurrencyConvertor.asmx?WSDL',
        'outputDir' => '/tmp/CurrencyConverter'
    ))
);

require '/tmp/CurrencyConverter/autoload.php';

// A class will generated representing the service.
// It is named after the element in the WSDL and has a method for each operation.
$service = new \CurrencyConvertor();
$request = new \ConversionRate(\Currency::USD, \Currency::EUR);
$response = $service->ConversionRate($request);

echo $response->getConversionRateResult();

Note that this is not recommended usage. Normally code generation and web services calls will be two separate processes., (*6)

Options

The generator supports a range of options which can be set in the configuration., (*7)

inputFile

The path or url to the WSDL to generate classes from., (*8)

outputDir

The directory to place the generated classes in. It will be created if it does not already exist., (*9)

namespaceName

The namespace to use for the generated classes. If not set classes will be generated without a namespace., (*10)

Example usage

The following configuration will place generated code from the CDYNE Weather web service under the CDyne\Weather namespace:, (*11)

$generator = new \Wsdl2PhpGenerator\Generator();
$generator->generate(
    new \Wsdl2PhpGenerator\Config(array(
        'inputFile' => 'http://wsf.cdyne.com/WeatherWS/Weather.asmx?wsdl',
        'outputDir' => '/tmp/weather',
        'namespaceName' => 'CDyne\Weather'
    ))
);

classNames

A comma-separared list or array of class names to generate. All other classes in the WSDL will be ignored., (*12)

This option is deprecated and will be removed in 4.0.0. Use operationNames instead., (*13)

Example usage

The following configuration will only generate AmazonEC2 and CopyImageType classes from the Amazon EC2 webservice., (*14)

$generator = new \Wsdl2PhpGenerator\Generator();
$generator->generate(
    new \Wsdl2PhpGenerator\Config(array(
        'inputFile' => 'https://s3.amazonaws.com/ec2-downloads/2013-10-01.ec2.wsdl',
        'outputDir' => '/tmp/amazon',
        'classNames' => 'AmazonEC2, CopyImageType'
    ))
);

operationNames

A comma-separated list or array of service operations to generate. This will only generate types that are needed for selected operations. The generated service class will only contain selected operation., (*15)

Example usage

The following configuration will generate operations and types for ReplaceRouteTableAssociation and RequestSpotInstances operations., (*16)

$generator = new \Wsdl2PhpGenerator\Generator();
$generator->generate(
    new \Wsdl2PhpGenerator\Config(array(
        'inputFile' => 'https://s3.amazonaws.com/ec2-downloads/2013-10-01.ec2.wsdl',
        'outputDir' => '/tmp/amazon',
        'operationNames' => 'ReplaceRouteTableAssociation, RequestSpotInstances'
    ))
);

sharedTypes

If enabled this makes all types with the same identify use the same class and only generate it once. The default solution is to prepend numbering to avoid name clashes., (*17)

constructorParamsDefaultToNull

If enabled this sets the default value of all parameters in all constructors to null. If this is used then properties must be set using accessors., (*18)

proxy

Specify a proxy to use when accessing the WSDL and other external ressources. This option should be used instead of [the proxy options support by the PHP SoapClient] (http://php.net/manual/en/soapclient.soapclient.php) as wsdl2phpgenerator uses more than the SOAP client to extract information., (*19)

The following formats are supported:, (*20)

  • An array with the following keys host, port, login and password matching [the proxy options support by the PHP SoapClient] (http://php.net/manual/en/soapclient.soapclient.php)
  • A string in an URL-like format

The proxy information is used by is used when accessing the WSDL to generate the code and for subsequent requests to the SOAP service., (*21)

Example usage

The following configuration will use a proxy to access the Google DoubleClick Ad Exchange Buyer SOAP API:, (*22)

$generator = new \Wsdl2PhpGenerator\Generator();
$generator->generate(
    new \Wsdl2PhpGenerator\Config(array(
        'inputFile' => 'https://ads.google.com/apis/ads/publisher/v201306/ActivityService?wsdl',
        'outputDir' => '/tmp/amazon',
        'proxy' => 'tcp://user:secret@192.168.0.1:8080'
    ))
);

soapClientClass

The base class to use for generated services. This should be a subclass of the PHP SoapClient., (*23)

Examples of third party SOAP client implementations which can be used:, (*24)

Note that it is the responsibility of the surrounding code to ensure that the base class is available during code generation and when calling web services., (*25)

Example usage

The following configuration will use the BeSimple SOAP client as base class:, (*26)

$generator = new \Wsdl2PhpGenerator\Generator();
$generator->generate(
    new \Wsdl2PhpGenerator\Config(array(
        'inputFile' => 'input.wsdl',
        'outputDir' => '/tmp/output',
        'soapClientClass' => '\BeSimple\SoapClient\SoapClient'
    ))
);

soapClientOptions

An array of configuration options to pass to the SoapClient. They will be used when accessing the WSDL to generate the code and as defaults for subsequent requests to the SOAP service. The PHP documentation has a list of supported options., (*27)

The list of options for the client can be extended by using more advanced SoapClient implementations., (*28)

Note that wsdl2phpgenerator expects the features option to contain SOAP_SINGLE_ELEMENT_ARRAYS. This ensures that type hints are consistent even if sequences only contain one element. If the features option is set explicitly in soapClientOptions the SOAP_SINGLE_ELEMENT_ARRAYS must also be added explicitly., (*29)

Example usage

The following configuration will enable basic authentication and set the connection timeout to 60 seconds., (*30)

```php $generator = new \Wsdl2PhpGenerator\Generator(); $generator->generate( new \Wsdl2PhpGenerator\Config(array( 'inputFile' => 'input.wsdl', 'outputDir' => '/tmp/output', 'soapClientOptions' => array( 'authentication' => SOAP_AUTHENTICATION_BASIC, 'login' => 'username', 'password' => 'secret', 'connection_timeout' => 60 )) )); ````, (*31)

Versioning

This project aims to use semantic versioning. The following constitutes the public API:, (*32)

  • \Wsdl2PhpGenerator\GeneratorInterface
  • \Wsdl2PhpGenerator\ConfigInterface
  • Generated code

Backwards incompatible changes to these means that the major version will be increased. Additional features and bug fixes increate minor and patch versions., (*33)

The Versions

28/05 2018

dev-master

9999999-dev

Simple class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

soap wsdl

28/05 2018

3.4.7

3.4.7.0

Simple class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

soap wsdl

28/05 2018

3.4.6

3.4.6.0

Simple class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

soap wsdl

26/04 2018

3.4.5

3.4.5.0

Simple class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

soap wsdl

24/04 2018

3.4.3

3.4.3.0

Simple class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

soap wsdl

24/04 2018

3.4.4

3.4.4.0

Simple class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

soap wsdl

13/01 2016

3.3.1

3.3.1.0

Simple class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

The Development Requires

soap wsdl

05/01 2016

3.3.0

3.3.0.0

Simple class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

The Development Requires

soap wsdl

21/08 2015

3.2.1

3.2.1.0

Simple class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

The Development Requires

soap wsdl

23/07 2015

dev-update-scrutinizer-config

dev-update-scrutinizer-config

Simple class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

The Development Requires

soap wsdl

13/05 2015

3.2.0

3.2.0.0

Simple class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

The Development Requires

soap wsdl

15/01 2015

3.1.2

3.1.2.0

Simple class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

The Development Requires

soap wsdl

12/01 2015

3.1.1

3.1.1.0

Simple class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

The Development Requires

soap wsdl

02/01 2015

3.1.0

3.1.0.0

Simple class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

The Development Requires

soap wsdl

12/12 2014

3.0.1

3.0.1.0

Simple class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

The Development Requires

soap wsdl

25/11 2014

3.0.0

3.0.0.0

Simple class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

The Development Requires

soap wsdl

17/11 2014

2.5.5

2.5.5.0

Simple utility and class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

The Development Requires

soap wsdl

06/11 2014

2.5.4

2.5.4.0

Simple utility and class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

The Development Requires

soap wsdl

03/11 2014

2.5.3

2.5.3.0

Simple utility and class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

The Development Requires

soap wsdl

22/10 2014

2.5.2

2.5.2.0

Simple utility and class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

The Development Requires

soap wsdl

11/09 2014

2.5.1

2.5.1.0

Simple utility and class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

The Development Requires

soap wsdl

09/09 2014

2.5.0

2.5.0.0

Simple utility and class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

The Development Requires

soap wsdl

13/08 2014

2.4.2

2.4.2.0

Simple utility and class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

The Development Requires

soap wsdl

24/07 2014

2.4.1

2.4.1.0

Simple utility and class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

The Development Requires

soap wsdl

22/04 2014

2.4.0

2.4.0.0

Simple utility and class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

The Development Requires

soap wsdl

23/02 2014

2.3.0

2.3.0.0

Simple utility and class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

The Development Requires

soap wsdl

08/01 2014

2.2.2

2.2.2.0

Simple utility and class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

The Development Requires

soap wsdl

01/01 2014

2.2.1

2.2.1.0

Simple utility and class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

The Development Requires

soap wsdl

13/12 2013

2.2.0

2.2.0.0

Simple utility and class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

The Development Requires

soap wsdl

09/12 2013

2.1.0

2.1.0.0

Simple utility and class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

The Development Requires

soap wsdl

30/10 2013

2.0.3

2.0.3.0

Simple utility and class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-soap *

 

The Development Requires

soap wsdl

29/10 2013

2.0.2

2.0.2.0

Simple utility and class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-soap *

 

The Development Requires

soap wsdl

28/10 2013

2.0.1

2.0.1.0

Simple utility and class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

The Development Requires

soap wsdl

26/10 2013

2.0.0

2.0.0.0

Simple utility and class library for generating php classes from a wsdl file.

  Sources   Download

MIT

The Requires

 

The Development Requires

soap wsdl