Giter VIP home page Giter VIP logo

packagegenerator's Introduction

Package Generator

Package Generator generates a PHP SDK from any WSDL.

License Latest Stable Version TeamCity build status Scrutinizer Code Quality Code Coverage Total Downloads StyleCI SymfonyInsight

Package Generator generates a PHP SDK from any WSDL so you can easily consume any SOAP Web Service without wondering how SOAP is used under the hood.

Package Generator provides many options to generate your package even if a few are required. This project has been tested with many WSDL and is currently used on the platform Providr.IO.

Package Generator generates files that are detailed in the MANIFEST. You are encouraged to read it to understand how and why the files are generated in addition to the way the generated classes are supposed to be used.

Installation

In a project:

composer require wsdltophp/packagegenerator --dev

With command line:

$ wget https://phar.wsdltophp.com/wsdltophp-php7.phar
$ chmod +x wsdltophp-php7.phar
$ mv wsdltophp-php7.phar /usr/local/bin/wsdltophp

With Docker:

$ docker run --rm -it mikaelcom/wsdltophp:tagname

Usage

There is two ways to generate your package (apart from being in a project and generating it through the command line):

  • standalone (default behaviour): this means the package is generated as an independent project with its own composer.json file. At the end of the generation, the root directory where the package has been generated will contain the composer.json, the composer.lock file and the vendor directory.
  • not standalone: this means the package is generated as part of an existing project using its own composer.json file.

The standalone option is fully detailed in the Standalone section.

All the options are fully detailed in the Options page.

In a project:

use WsdlToPhp\PackageGenerator\ConfigurationReader\GeneratorOptions;
use WsdlToPhp\PackageGenerator\Generator\Generator;

// Options definition: the configuration file parameter is optional
$options = GeneratorOptions::instance(/* '/path/file.yml' */);
$options
    ->setOrigin('http://developer.ebay.com/webservices/latest/ebaySvc.wsdl')
    ->setDestination('./MySdk')
    ->setComposerName('myproject/mysdk');
// Generator instantiation
$generator = new Generator($options);
// Package generation
$generator->generatePackage();

With command line:

The command line is:

$ wsdltophp generate:package \
    --urlorpath="http://developer.ebay.com/webservices/latest/ebaySvc.wsdl" \
    --destination="./MySdk" \
    --composer-name="myproject/mysdk" \
    --force

In order to see all the used options, just remove the --force argument.

With Docker:

Such as with the command line above, simply use the docker run command line before:

$ docker run --rm -it --volume $PWD:/var/www mikaelcom/wsdltophp:tagname generate:package \
    --urlorpath="http://developer.ebay.com/webservices/latest/ebaySvc.wsdl" \
    --destination="/var/www/MySdk" \
    --composer-name="myproject/mysdk" \
    --force

In order to see all the used options, just remove the --force argument.

Versions

4.0

First released on 03 April 2021, maintained until version 6.0 is released. Please read the UPGRADE-4.0 note in order to acknowledge the main changes.

3.0

First released on 04 May 2018, maintained until version 5.0 is released. Please read the UPGRADE-3.0 note in order to acknowledge the main changes.

NOT MAINTAINED ANYMORE: even if version 5 is not published nor is expected soon, maintaining 2 versions, especially for an old PHP version, is time consuming, sorry for the people who would be still using it which would encounter issues fixed in the latest version.

2.0

Not maintained since 03 April 2021.

First released on 29 Apr 2016, maintained until version 4.0 is released.

1.0

Not maintained anymore

Testing

# launch all tests
$ phpunit

# launch a testsuite: command, configuration, utils, model, container, parser, file, packagegenerator
$ phpunit --testsuite=model

Testing using Docker

Thanks to the Docker image of phpfarm, tests can be run locally under any PHP version using the cli:

  • php-7.4

First of all, you need to create your container which you can do using docker-compose by running the below command line from the root directory of the project:

$ docker-compose up -d --build

You then have a container named package_generator in which you can run composer commands and php cli commands such as:

# install deps in container (using update ensure it does use the composer.lock file if there is any)
$ docker exec -it package_generator php-7.4 /usr/bin/composer update
# run tests in container
$ docker exec -it package_generator php-7.4 -dmemory_limit=-1 vendor/bin/phpunit

Contributing

Please see CONTRIBUTING for details. In addition, code documentation is at doc.wsdltophp.com.

Credits

Developers who helped on this project are listed in the composer.json file as Contributor and are:

FAQ

If you have any question, please read the Options page about the available options to generate the package.

There is also a FAQ that contains miscellaneous questions about the package generation and its usage.

Then if you still have a question, feel free to create an issue.

License

The MIT License (MIT). Please see License File for more information.

packagegenerator's People

Contributors

alexkratky avatar cliffordvickrey avatar derrabus avatar dypa avatar faithfulman18 avatar gemorroj avatar gugglegum avatar hluup avatar jdreesen avatar localheinz avatar mcatirau-avantajprim avatar mikaelcom avatar oipnet avatar phobetor avatar phordijk avatar phryneas avatar scrutinizer-auto-fixer avatar tbreuss avatar waldo2188 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

packagegenerator's Issues

__Construct set methods call and enum value conflict

Hello,

I use the last version of PackageGenerator to re-build source of wsdl definitions. (first generation in past may).

I see the are a lot of differences since last version i used, including an error cause by valueIsValid() in set functions of enum objects.

When i instancy object, i set no property in declaration ( $foo = myObject(); ) then, i set properties with setProperty() functions after.

by default, __construct method call set methods of each object with null value but valueIsValid function not expect null value, just corrects values/object returned by getValidValues.

capture d ecran 2015-09-14 a 18 11 12

capture d ecran 2015-09-14 a 18 10 41

PHP Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Value "" is invalid, please use one of: Pound, Kilogram, Tonnes' in /[PATH]/src/Struct/Weight.php:66

Can you add an option in the generator to add null value as valid in getValidValues() array returned ?

Regards,

--wsdl-genautoload=false also controls creation of sample.php file (console mode)

I was assuming that --wsdl-gentutorial=[true/false] was controlling the creation of sample.php file.

The behaviour I get is --wsdl-genautoload=true generates autoload and sample.php, --wsdl-genautoload=false does generates neither autoload.php not sample.php.

Is this is a bug, I would be a minor one obvisously.
BR
Geabulek

Create PHAR

It would be great if people could just use a phar for generating classes.

classmap and namespaces are wrong when not using a prefix

generated namespace for the classes:
namespace MyNamespace\; which should not have a trailing slash,

also in the classmap the same problem is there:
'ArrayOfstring' => '\MyNamespace\\ArrayType\ArrayOfstring',

This forces me to use a prefix, while using namespaces by itself already avoids the need to prefix classnames already.

Objects at different levels with same name, get merged

Now, I'm not sure if this is a problem with the API I'm trying to connect to, or a problem in this library. I suspect there may be a bit of each. Straight in, here is the WSDL:

http://partners.rowebooks.co.uk/test/OrderService.svc?wsdl

Here is the schema, where I think the problems start:

http://partners.rowebooks.co.uk/test/OrderService.svc?xsd=xsd0

Notice that there is an outer element order with some fields including orders. Now orders is optional - 0 or 1 occurrences. According to the customer's spec, it should be 1 or more (unbounded), so I suspect something is wrong in there.

Inside orders is another optional object called order. That has the same name as the top-level wrapper, but different fields. When I generate code using this library, both of these order objects get merged into one (StructType\Order) with all the fields merged together. Should these not be two separate objects, perhaps Order and OrdersOrder or something?

I can get it to kind of work by creating $order_inner and $order_wrapper, setting different fields and leaving the rest blank, but the inner order does not seem to recognise the array of Detail objects I give it - it does not complain, but they don't get included in the XML that is sent.

Apologies if I'm not using the right lingo - just take my "objects" and "fields" as a flexible lump of data :-)

Use schema attribute's attributes to apply validation rule on generated properties

Validation rules should be defined using at least these attributes:

  • minLength, simple test on value: strlen(value) >= minLength
  • maxLength, simple test on value: strlen(value) <= maxLength
  • pattern, simple test on value: preg_match(sprintf('/%s/', pattern), value)
  • and so on

The validation rules should be generated based on an option. This option would be enabled by default. If a user does not want the validation, then he'll have to disable the option on the generation.

Does anyone have an opinion on this enhancement? Would it be good/bad/useful/useless/user's pain in the ass?

Problem with generated request XML

Hello.
I'm having some trouble using this lib and I hope someone can help me.

Using the lib Service SOAP client, the generated XML is the following and the request fails:
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn://XXX/AppEntityLayer/Services/CustomerContract/v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SOAP-ENV:Body> <ns1:GetDetailsRequest> <Header xsi:type="ns1:Header"/> <Authentication> <UserID>user123</UserID> <Language>PT</Language> </Authentication> <CustomerContract xsi:type="ns1:CustomerContract"/> </ns1:GetDetailsRequest> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

Using the native PHP SOAP client, I get the following generated XML and it works:
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn://XXX/AppEntityLayer/Services/CustomerContract/v3"> <SOAP-ENV:Body> <ns1:GetDetailsRequest> <Header> <application>App</application> <target>CRM</target> </Header> <Authentication> <UserID>user123</UserID> <Language>PT</Language> </Authentication> <CustomerContract> <NIF>PT123456789</NIF> </CustomerContract> </ns1:GetDetailsRequest> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

I could use the native SOAP client, but I don't really know why, the wsdl_classmap is not working. The response isn't mapping to the Structs objects. I'm using the ClassMap::get() method.
PHP version is 5.5
If more information is needed, I prefer not doing publicly.

Thanks in advance!

Add Namespace support

The structure of a package could be the following.

[Package Name]
[Package Name]\Enum
[Package Name]\Service
[Package Name]\Struct

(actually, prefix could be replaced by namespace support).

Duplicated properties within the same struct class

When parsing types provided by SoapClient::__getTypes() method, types are sometimes returned twice with different properties.
It seems the WsdlToPhp\PackageGenerator\Container\Model\Struct::addStruct() method does not check if the property being added is already declared fo the current struct.

Case :

  • Web service: NetSuite
  • Struct returned twice by SoapClient::__getTypes():
    • [122] => struct CurrencyRate { RecordRef baseCurrency; RecordRef fromCurrency; double exchangeRate; dateTime effectiveDate;}
    • [953] => struct CurrencyRate { RecordRef baseCurrency; RecordRef transactionCurrency; double exchangeRate; dateTime effectiveDate; string internalId;}

As we can see, baseCurrency, exchangeRate and effectiveDate are returned in the first definition. Not checking the existence of these properties whithin the CurrentRate struct before adding them when parsing the second definition makes the final CurrentyRate struct class containing double declaration of each property.

minOccurs=0 not works

Hello

DailyBudget have minOccurs=0 and nillable.

When I created request without setting DailyBudget in actual XML data of request i found, that DailyBudget was set to nil. It should not appear in request. And all elements with minOccurs=0 should not appear until they was set.

Appearance of DailyBudget leads to an error, cause it can be set only an special cases depends on other settings:

Daily budget management is available if a manual display strategy is selected in the campaign, and if the Settings parameter returned by the get method has DAILY_BUDGET_ALLOWED with the value YES. Otherwise, an attempt to set the daily budget results in an error.
https://tech.yandex.com/direct/doc/ref-v5/campaigns/update-docpage/

I can't provide extended tests for this issue until Monday.

Reserved PHP-Keywords in Class Names

I've found a problem relating to reserved PHP Keywords.

We are using a WSDL containg the following section

<wsdl:operation name="doBankTransferAuth" parameterOrder="in0 in1 in2">
    <wsdl:input message="impl:doBankTransferAuthRequest" name="doBankTransferAuthRequest"/>
    <wsdl:output message="impl:doBankTransferAuthResponse" name="doBankTransferAuthResponse"/>
</wsdl:operation>

which results in a ServiceClass class Do. Due to the case-insensitivity of reserved PHP-Keywords, this is an syntax error in the generated class (up to now, I wasn't aware of this problem neither).

I've analyzed the problem and found out 2 things, that may lead to this problem:

  1. \WsdlToPhp\PackageGenerator\ConfigurationReader\ReservedKeywords does a case sensitive keyword check, so non-lowercase occurrences of the filtered keywords are not detected.
  2. It seems like \WsdlToPhp\PackageGenerator\ConfigurationReader\ReservedKeywords is only used to check the the name inside the WSDL (in this case doBankTransferAuth) but not the derived Classname Do.

A quick fix to avoid this problem is generating the classes with an static prefix or suffix, but we like to avoid this.
If desired, I would offer to provide a pull request for this.

XSD types are not well inherited by elements

When having this XSD definition:

<simpleType name="string2048">
    <restriction base="normalizedString">
        <minLength value="1" />
        <maxLength value="2048" />
    </restriction>
</simpleType>

Inherited by the element MD:

<element name="MD" type="ddp:string2048" minOccurs="1" maxOccurs="1">
    <annotation>
        <documentation>The MD - Merchant Data from the 3DS request/response. This is a parameter from the original start response, so the same type is used.</documentation>
    </annotation>
</element>

The element MD is generated as:

/**
 * The MD
 * Meta informations extracted from the WSDL
 * - documentation: The MD - Merchant Data from the 3DS request/response. This is a parameter from the original start response, so the same type is used.
 * - maxOccurs: 1
 * - minOccurs: 1
 * @var string2048
 */
 public $MD;

The element MD is used in the class constructor as:

public function __construct(string2048 $mD = null, $pARes = null, \DOMDocument $any = null)

Two major issues:

  • When the MD element is passed as parameter to a method, its type hint is string2048 which is invalid and should be void as it is in fact a string.
  • The generated property MD should have as doc block the restrictions defined by the string2048 type such as minLength: 1 and maxLength: 2048

Exception thrown when trying to generate from CLI

$ php console wsdltophp:generate:package --wsdl-urlorpath="http://some-wsdl.xml" --wsdl-destination="~/Code/wsdl01/" --wsdl-prefix="Fungku" --force

[Exception]
DateTime::_construct(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default
timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier.
We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.

Issue with Tutorial

So I was able to get the package to build. If I try to run the tutorial, it throws an exception saying it cannot find the class, which happens to be one of the classes generated by the package generator...

I'm sure it's something obvious I'm missing...

Thoughts?

Incorrect variable type

WSDL is https://api.direct.yandex.ru/live/v4/wsdl/
Class is \StructType\BannerPhraseInfo

    /**
     * The AuctionBids
     * Meta informations extracted from the WSDL
     * - nillable: true
     * - arrayType: namesp1:PhraseAuctionBids[]
     * - ref: soapenc:arrayType
     * @var Array
     */
    public $AuctionBids;

it leads to

    /**
     * Set AuctionBids value
     * @param Array $auctionBids
     * @return \AppBundle\Providers\YandexDirect\ApiV4Live\StructType\BannerPhraseInfo
     */
    public function setAuctionBids(Array $auctionBids = null)
    {
        $this->AuctionBids = $auctionBids;
        return $this;
    }

#49 and there is no validation in this case.

Generator profile

It would be great to be able to select a generator profile.
A profile would consist of configuring which parsers are used or not. The goal is to provide a way to avoid to use specific parsers if we don't need/want them to be used.
For example, we could have a profile that only uses the SoapClient parsers (Structs and Functions). We then won't get inheritance between Structs but we would gain in time generation.

Thank You

This isn't an issue but thank you for building this. Finding this package really saved me a lot of time and helped me understand SOAP in PHP more than any other resource on the internet. Also, really cool seeing a package use box project.

Once again, thanks.

Error while passing array parameter

After successfully generating package and trying to send a request I get this error

Catchable fatal error: Argument 1 passed to StructType\LogonRequest::__construct() must be an instance of StructType\LogonRequestData, array given

Code

if ($logon->Logon(new \StructType\LogonRequest($params)) !== false) {

Support for Cyrillic alphabet

When having this type of element in the WSDL:

<xs:element name="КонтактнаяИнформация" type="tns:КонтактнаяИнформация" />

It is converted to ________________________________________, not so good ....

It would be good to be able to generate the class with the attributes keeping the original name (as Cyrillic seems to be usable in PHP code)

Pardon me if I'm wrong, but it seems to be that @GroxExMachine you're from Russia, could you give some help on this matter?

Thx

Support for several services under one provider and several providers

In my project I have several services from one provider, so the below is proposed structure.
It will be good, if generator will support it.

/src/Services/Provider1

  • AdGroups (own wsdl)
    • ArrayType
    • EnumType
    • ServiceType
    • StructType
  • Campaigns (own wsdl)
    • ArrayType
    • EnumType
    • ServiceType
    • StructType

/src/Services/Provider2

  • AdGroups (own wsdl)
    • ArrayType
    • EnumType
    • ServiceType
    • StructType
  • Campaigns (own wsdl)
    • ArrayType
    • EnumType
    • ServiceType
    • StructType

Generate package under src folder

As for any well organized project/library, it would be good to have the generated classes/files located under the src folder.

We would then have:

├── src
    ├── EnumType
        ├── << FILES >>
    ├── ServiceType
        ├── << FILES >>
    ├── StructType
        ├── << FILES >>
    ├── ClassMap.php
├── vendor
├── composer.json
├── composer.lock
└── tutorial.php

Support for arrays

In some cases we need to setup several values of Enum type.

Original generated code does not support such way

$CampaignsGetRequest->setFieldNames([
    \Campaigns\EnumType\CampaignsCampaignFieldEnum::VALUE_NAME,
    \Campaigns\EnumType\CampaignsCampaignFieldEnum::VALUE_DAILYBUDGET
]);

Original

    /**
     * Set FieldNames value
     * @uses \Campaigns\EnumType\CampaignsCampaignFieldEnum::valueIsValid()
     * @uses \Campaigns\EnumType\CampaignsCampaignFieldEnum::getValidValues()
     * @param string $fieldNames
     * @return \Campaigns\StructType\CampaignsGetRequest
     */
    public function setFieldNames($fieldNames = null)
    {
        if (!\Campaigns\EnumType\CampaignsCampaignFieldEnum::valueIsValid($fieldNames)) {
            throw new \InvalidArgumentException(sprintf('Value "%s" is invalid, please use one of: %s', $fieldNames, implode(', ', \Campaigns\EnumType\CampaignsCampaignFieldEnum::getValidValues())), __LINE__);
        }
        $this->FieldNames = $fieldNames;
        return $this;
    }

Modified

    /**
     * Set FieldNames value
     * @uses \Campaigns\EnumType\CampaignsCampaignFieldEnum::valueIsValid()
     * @uses \Campaigns\EnumType\CampaignsCampaignFieldEnum::getValidValues()
     * @param string $fieldNames
     * @return \Campaigns\StructType\CampaignsGetRequest
     */
    public function setFieldNames($fieldNames = null)
    {
        // ArrayOfValues
        // The existence of this block should be based on maxOccurs
        if (is_array($fieldNames)){
            foreach ($fieldNames as $fieldName) {
                if (!\Campaigns\EnumType\CampaignsCampaignFieldEnum::valueIsValid($fieldName)) {
                    throw new \InvalidArgumentException(sprintf('Value "%s" is invalid, please use one of: %s', $fieldNames, implode(', ', \Campaigns\EnumType\CampaignsCampaignFieldEnum::getValidValues())), __LINE__);
                }
            }
        } // /ArrayOfValues
        elseif (!\Campaigns\EnumType\CampaignsCampaignFieldEnum::valueIsValid($fieldNames)) {
            throw new \InvalidArgumentException(sprintf('Value "%s" is invalid, please use one of: %s', $fieldNames, implode(', ', \Campaigns\EnumType\CampaignsCampaignFieldEnum::getValidValues())), __LINE__);
        }
        $this->FieldNames = $fieldNames;
        return $this;
    }

This code we need to use Yandex Direct and Google AdWords.

Example
Yandex.Direct API Campaigns
WSDL link can be found here

And what message we should have in case of error? Do "please use one of" still good?

Name "0001CreateRequest" is invalid, please provide a valid name

For an operation named like 0001CreateRequest, the method is named as is, so we get this exception:

[InvalidArgumentException]
Name "0001CreateRequest" is invalid, please provide a valid name

Numbers at the begining of a method should be replaced by an underscore when defining the method name and use the __call magic method when calling the SoapClient.

Unable to create function parameter for method "mapIpndDetailsToNumber" with type "NULL"

The exceptions:

[InvalidArgumentException]
  Unable to create function parameter for method "mapIpndDetailsToNumber" with type "NULL"
[InvalidArgumentException]
  Name "0" is invalid, please provide a valid name

The operation declarations:

<wsdl:operation name="mapIpndDetailsToNumber">
    <wsdl:documentation>Maps IPND information to a given number in your inventory.</wsdl:documentation>
        <wsdl:input name="mapIpndDetailsToNumberRequest" message="tns:mapIpndDetailsToNumberRequest">
            <wsdl:documentation>Input the required lease parameters to perform the lease operation</wsdl:documentation>
        </wsdl:input>
        <wsdl:output name="mapIpndDetailsToNumberResponse" message="tns:mapIpndDetailsToNumberResponse">
            <wsdl:documentation>No response output if the operation was successful</wsdl:documentation>
        </wsdl:output>
        <wsdl:fault name="NumberManagementErrorMsg" message="tns:NumberManagementErrorMsg">
            <wsdl:documentation>The error message if there was a problem processing this request</wsdl:documentation>
        </wsdl:fault>
</wsdl:operation>
<wsdl:operation name="mapIpndDetailsToNumber">
            <soap:operation soapAction="mapIpndDetailsToNumber" style="rpc" />
            <wsdl:input name="mapIpndDetailsToNumberRequest">
                <soap:body use="literal" namespace="http://localhost/soap/version_1/number" />
            </wsdl:input>
            <wsdl:output name="mapIpndDetailsToNumberResponse">
                <soap:body use="literal" namespace="http://localhost/soap/version_1/number" />
            </wsdl:output>
            <wsdl:fault name="NumberManagementErrorMsg">
                <soap:fault name="NumberManagementErrorMsg" use="literal" />
            </wsdl:fault>
        </wsdl:operation>
<wsdl:message name="mapIpndDetailsToNumberRequest">
    <wsdl:documentation>This is the request operation to map IPND details to a specified number</wsdl:documentation>
    <wsdl:part name="number" type="xsd:string">
        <wsdl:documentation>The number on which to map the ipnd details to</wsdl:documentation>
    </wsdl:part>
    <wsdl:part name="ipndInformation" type="ns1:IpndInformation">
        <wsdl:documentation>The IPND information to associate with the number</wsdl:documentation>
    </wsdl:part>
</wsdl:message>

The Struct declaration:

    <xs:complexType name="IpndInformation">
        <xs:annotation>
            <xs:documentation>The representation of the ipnd information for a number</xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="serviceAddress" type="tns:AS4212Address">
                <xs:annotation>
                    <xs:documentation>The service address the number is associated with.</xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="directoryAddress" type="tns:AS4212Address">
                <xs:annotation>
                    <xs:documentation>The directory address the number is associated with. This is only required in the case where the listing type is LE (Listed Entry).</xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="contactInformation" type="tns:ContactInformation" nillable="false">
                <xs:annotation>
                    <xs:documentation>The contact information to populate the IPND details with</xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
    </xs:complexType>

Externalize wsdl/schema native types

From WsdlToPhp\PackageGenerator\File\AbstractModelFile::getValidType():

array(
            'int',
            'byte',
            'bool',
            'date',
            'long',
            'float',
            'short',
            'string',
            'double',
            'boolean',
            'decimal',
            'integer',
            'dateTime',
            'timeStamp',
            'timestamp',
            'unsignedInt',
            'unsignedLong',
            'unsignedByte',
            'unsignedShort',
            'DayOfWeekType',
            'negativeInteger',
            'positiveInteger',
            'nonNegativeInteger',
            'nonPositiveInteger',
        )

It would be better to have this list in a configuration file loaded by a Configuration reader class that takes care of returning the correct value depending on the input value.

Inherited class generates wrong object in php.

Hi,
I have a structure like this in my C# soap service:

    [DataContract]
    public class order
    {
...
    }

    [DataContract]
    public class offer : order
    {
...
    }

which results in this PHP code:


class MyOffer extends MyOrder 
{
// all Attributes from offer are here

    /**
     * The offer
     * Meta informations extracted from the WSDL
     * - minOccurs: 0
     * - nillable: true
     * @var order
     */
    public $offer;

    /**
     * Set offer value
     * @param order $offer
     * @return \MyNameSpace\StructType\MyOffer
     */
    public function setOffer(order $offer = null)
    {
        $this->offer = $offer;
        return $this;
    }

}

So even though it already extends MyOrder as expected, it also adds an attribute "offer" of type "order" - the class "order" of course does not exist in php, as it is mapped to MyOrder.

This happens on the latest dev-master commit.

If you need any XSD files for debugging, I'd be happy to provide you those in private email, but I'd rather not append these to this public ticket. Just send me an email to [email protected] :)

Throw an exception instead of returning false

When having this type of constructor

public function __construct($query = null, $appId = null, \Api\ArrayType\ApiArrayOfSourceType $sources = null, \Api\StructType\ApiSearchRequest $parameters = null, $version = '2.2', $market = null, $uILanguage = null, $adult = null, $latitude = null, $longitude = null, $radius = null, \Api\ArrayType\ApiArrayOfSearchOption $options = null, \Api\StructType\ApiWebRequest $web = null, \Api\StructType\ApiImageRequest $image = null, \Api\StructType\ApiPhonebookRequest $phonebook = null, \Api\StructType\ApiVideoRequest $video = null, \Api\StructType\ApiNewsRequest $news = null, \Api\StructType\ApiMobileWebRequest $mobileWeb = null, \Api\StructType\ApiTranslationRequest $translation = null)
{
    $this
        ->setQuery($query)
        ->setAppId($appId)
        ->setSources($sources)
        ->setParameters($parameters)
        ->setVersion($version)
        ->setMarket($market)
        ->setUILanguage($uILanguage)
        ->setAdult($adult)
        ->setLatitude($latitude)
        ->setLongitude($longitude)
        ->setRadius($radius)
        ->setOptions($options)
        ->setWeb($web)
        ->setImage($image)
        ->setPhonebook($phonebook)
        ->setVideo($video)
        ->setNews($news)
        ->setMobileWeb($mobileWeb)
        ->setTranslation($translation);
}

and this method:

public function setAdult($adult = null)
{
    if (!\Api\EnumType\ApiAdultOption::valueIsValid($adult)) {
        return false;
    }
    $this->Adult = $adult;
    return $this;
}

By default the error is raised which it not very comprehensible.

It should raise an exception

Gather operations in one ServiceType class

It would be useful to be able to gather operations/methods in only one ServiceType class instead of having one class per operation that begins/ends with the same word.

Leading zero not taken into account in enumeration classes

The Enum class created from a tag with a list of possible numerical values with leading zero do not take the leading zero into account.

WSDL excerpt:

                <xsd:restriction base="xsd:token">
                    <xsd:enumeration value="01"/>
                    <xsd:enumeration value="02"/>
                    <xsd:enumeration value="03"/>
                    <xsd:enumeration value="04"/>
                    <xsd:enumeration value="05"/>
                    <xsd:enumeration value="06"/>
                    <xsd:length value="2"/>
                </xsd:restriction>

Enum class

class E1EnumActionCode extends E1WsdlClass
{
    /**
     * Constant for value 1
     * @return integer 1
     */
    const VALUE_1 = 1;
    /**
     * Constant for value 2
     * @return integer 2
     */
    const VALUE_2 = 2;
    /**
     * Constant for value 3
     * @return integer 3
     */
    const VALUE_3 = 3;
    /**
     * Constant for value 4
     * @return integer 4
     */
    const VALUE_4 = 4;
    /**
     * Constant for value 5
     * @return integer 5
     */
    const VALUE_5 = 5;
    /**
     * Constant for value 6
     * @return integer 6
     */
    const VALUE_6 = 6;
}

Wrong Header Namespace ?

Generating a package from https://outlook.office365.com/EWS/services.wsdl, we get this type of method in a ServiceType class:

/**
 * Sets the ExchangeImpersonation SoapHeader param
 * @uses SoapClientBase::setSoapHeader()
 * @param \Ews\StructType\EwsExchangeImpersonationType $exchangeImpersonation
 * @param string $nameSpace
 * @param bool $mustUnderstand
 * @param string $actor
 * @return bool
 */
public function setSoapHeaderExchangeImpersonation(
    \Ews\StructType\EwsExchangeImpersonationType $exchangeImpersonation,
    $nameSpace = 'http://schemas.microsoft.com/exchange/services/2006/messages',
    $mustUnderstand = false,
    $actor = null)
{
    return $this->setSoapHeader($nameSpace, 'ExchangeImpersonation', $exchangeImpersonation, $mustUnderstand, $actor);
}

The namespace is wrong and should be http://schemas.microsoft.com/exchange/services/2006/types

Auto-Adding id="ref#" attribute

Can you please help me understand why this:

$roomStay->setRoomRates(new RoomRatesType(
            array(
                new RoomRateType(
                    $roomRate->getRatePlanInfo()->getCode(),
                    $roomRate->getRoomInfo()->getCode(),
                    new RatesType($rates),
                    $roomRate->getRatePlanInfo()->getPromotionalCode()
                ),
            )
        ));

results in this:

<ns1:RoomRates id="ref1">
   <ns1:RoomRate RatePlanCode="RATE" RoomCode="DBL">
      <ns1:Rates>
         <ns1:Rate From="2015-08-14" To="2015-08-17">
            <ns1:Base AmountAfterTax="200.00" AmountBeforeTax="0" CurrencyCode="ABC"/>  
         </ns1:Rate>
      </ns1:Rates>
   </ns1:RoomRate>
</ns1:RoomRates>

and how can I remove the id="ref1" attribute

Thank you very much.

No autocomplete because of return type on a new line after @return in annotation

WSDL is https://api.direct.yandex.ru/live/v4/wsdl/

Autocomplete do not work with this and IDE warn about "Return type did not match":

    /**
     * Method to call the operation originally named GetForecast
     * @uses AbstractSoapClientBase::getSoapClient()
     * @uses AbstractSoapClientBase::setResult()
     * @uses AbstractSoapClientBase::getResult()
     * @uses AbstractSoapClientBase::saveLastError()
     * @param string $params
     * @return
     * \AppBundle\Providers\YandexDirect\ApiV4Live\StructType\GetForecastInfo|bool
     */
    public function GetForecast($params)
    {
        try {
            $this->setResult(self::getSoapClient()->GetForecast($params));
            return $this->getResult();
        } catch (\SoapFault $soapFault) {
            $this->saveLastError(__METHOD__, $soapFault);
            return false;
        }
    }

Autocomplete work with this return value

    /**
     * Method to call the operation originally named GetForecast
     * @uses AbstractSoapClientBase::getSoapClient()
     * @uses AbstractSoapClientBase::setResult()
     * @uses AbstractSoapClientBase::getResult()
     * @uses AbstractSoapClientBase::saveLastError()
     * @param string $params
     * @return \AppBundle\Providers\YandexDirect\ApiV4Live\StructType\GetForecastInfo|bool
     */
    public function GetForecast($params)
    {
        try {
            $this->setResult(self::getSoapClient()->GetForecast($params));
            return $this->getResult();
        } catch (\SoapFault $soapFault) {
            $this->saveLastError(__METHOD__, $soapFault);
            return false;
        }
    }

Error on creating the files using command line

When using the command line, the files are not written nor the directory and warning are displayd: PHP Warning: file_put_contents(******): failed to open stream: No such file or directory in /var/www/workspace/PackageGenerator/src/File/AbstractFile.php on line 60

Version/Branch: feature/mandevilla-phar

Define the composer name

As proposed in the PR #23 by @ceeram, we should be able to define the composer name of the generated package as a composer.json file is created to define the generated package's dependencies

All tags defined by a Type outs empty in soap requests

Hi,

Using the last version of PackageGenerator (compare to functional last may version again)

All tags that refer to an other object are empties, see below :

extract of old requestXML generated :

<ns1:AircraftDefinition xsi:type="ns1:ICAOIdentAircraftSpecification">
       <ns1:Equipment xsi:nil="true"/>
       <ns1:FuelBias>-10</ns1:FuelBias>
       <ns1:ICAOIdent>E55P</ns1:ICAOIdent>
       <ns1:MassAndBalanceData xsi:nil="true"/>
       <ns1:PreferedDataLevel>Global</ns1:PreferedDataLevel>
       <ns1:SpeedBias>0</ns1:SpeedBias>
       <ns1:MaxRampMass xsi:nil="true"/>
       <ns1:MaxTakeOffMass xsi:nil="true"/>
       <ns1:MaxLandingMass xsi:nil="true"/>
       <ns1:MaxZeroFuelMass xsi:nil="true"/>
</ns1:AircraftDefinition>

and generated with last version :

<ns1:AircraftDefinition/>

Same here :

old :

<ns1:FlightLevelDefinition xsi:type="ns1:OptimumFlightLevelDefinition">
       <ns1:UpperBound xsi:nil="true"/>
       <ns1:LowerBound>0</ns1:LowerBound>
</ns1:FlightLevelDefinition>

new : (here, upperBound value appears... )

<ns1:FlightLevelDefinition>
       <ns1:UpperBound>150</ns1:UpperBound>
</ns1:FlightLevelDefinition>

Same issues for all specific types tags.

I use this definitions : https://testservices.aviationcloud.aero/FlightGenerationService.svc?wsdl

Old code :

<?php

require 'AFS_AutoLoad.php';

function GenerateFlightPlan($route, $aircraftICAO, $depICAO, $desICAO, $altn1ICAO, $altn2ICAO, $date, $flightLevel, $trafficLoad, $routeToAlternate1, $routeToAlternate2)
{
    $wsdl = array();
    $wsdl[FGS_WsdlClass::WSDL_URL] = 'https://testservices.aviationcloud.aero/FlightGenerationService.svc?wsdl';
    $wsdl[FGS_WsdlClass::WSDL_CACHE_WSDL] = WSDL_CACHE_MEMORY;
    $wsdl[FGS_WsdlClass::WSDL_SOAP_VERSION] = SOAP_1_1;
    $wsdl[FGS_WsdlClass::WSDL_TRACE] = true;

    $serviceCalculate = new FGS_ServiceCalculate($wsdl);

    $paxNb = 1;
    $paxMassValue = $trafficLoad;

    $totalWeight = new FGS_StructWeight();
    $totalWeight->setUnit(FGS_EnumWeightUnit::VALUE_KILOGRAM);
    $totalWeight->setValue($paxMassValue);

    $paxLoad = new FGS_StructUnspecifiedPaxTypeLoad();
    $paxLoad->setNumberOfPax($paxNb);
    $paxLoad->setTotalWeight($totalWeight);

    $paxLoadSpecification = new FGS_StructSimplePaxLoadSpecification();
    $paxLoadSpecification->setEnableAutoLuggage(FALSE);
    $paxLoadSpecification->setPaxLoad($paxLoad);

    $flightSpecification = new FGS_StructFlightSpecification();

    $aircraftDefinition = new FGS_StructICAOIdentAircraftSpecification();
    $aircraftDefinition->setFuelBias(-10);
    $aircraftDefinition->setICAOIdent($aircraftICAO);
    $aircraftDefinition->setPreferedDataLevel(FGS_EnumDataLevel::VALUE_GLOBAL);
    $aircraftDefinition->setSpeedBias(0);

    $departureAirport = new FGS_StructAirport();
    $departureAirport->setICAOCode($depICAO);
    $departureAirport->setIsAirportOfEntry(FALSE);
    $departureAirport->setSupportsIFR(FALSE);
    $departureAirport->setType(FGS_EnumAirportType::VALUE_CIVIL);

    $destinationAirport = new FGS_StructAirport();
    $destinationAirport->setICAOCode($desICAO);
    $destinationAirport->setIsAirportOfEntry(FALSE);
    $destinationAirport->setMagneticVariation(0);
    $destinationAirport->setSupportsIFR(FALSE);
    $destinationAirport->setType(FGS_EnumAirportType::VALUE_CIVIL);

    $initialSpeed = new FGS_StructSpeed();
    $initialSpeed->setUnit(FGS_EnumSpeedUnit::VALUE_KNOTS);
    $initialSpeed->setValue(0);

    $routeToDestination = new FGS_StructRoute();
    //$routeToDestination->setFlightLevel($flightLevel);
    $routeToDestination->setInitialSpeed($initialSpeed);
    $routeToDestination->setATCroute($route);

    $upperBound = NULL;
    $lowerBound = 0;

    $optimumflightLevelDefinition = new FGS_StructOptimumFlightLevelDefinition();
    $optimumflightLevelDefinition->setLowerBound ( $lowerBound );
    $optimumflightLevelDefinition->setUpperBound ( $upperBound );

    $flightSpecification->setAircraftDefinition($aircraftDefinition);
    $flightSpecification->setDepartureAirport($departureAirport);
    $flightSpecification->setDestinationAirport($destinationAirport);
    $flightSpecification->setIsETOPSFlight(FALSE);
    $flightSpecification->setRouteToDestination($routeToDestination);
    $flightSpecification->setScheduledTimeOfDeparture($date);
    $flightSpecification->setPaxLoadSpecification($paxLoadSpecification);
    $flightSpecification->setFlightLevelDefinition($optimumflightLevelDefinition);

    if ( isset($altn1ICAO) && $altn1ICAO != "" )
    {
        $alternate1Airport = new FGS_StructAirport();
        $alternate1Airport->setICAOCode($altn1ICAO);
        $alternate1Airport->setIsAirportOfEntry(FALSE);
        $alternate1Airport->setMagneticVariation(0);
        $alternate1Airport->setSupportsIFR(FALSE);
        $alternate1Airport->setType(FGS_EnumAirportType::VALUE_CIVIL);
        $flightSpecification->setAlternateAirport1($alternate1Airport);

        if (isset($routeToAlternate1) && $routeToAlternate1 != "") {
            $route = new FGS_StructRoute();
            $route->setATCroute($routeToAlternate1);
            $flightSpecification->setRouteToAlternate1($route);
        }
    }

    if ( isset($altn2ICAO) && $altn2ICAO != "" )
    {
        $alternate2Airport = new FGS_StructAirport();
        $alternate2Airport->setICAOCode($altn2ICAO);
        $alternate2Airport->setIsAirportOfEntry(FALSE);
        $alternate2Airport->setMagneticVariation(0);
        $alternate2Airport->setSupportsIFR(FALSE);
        $alternate2Airport->setType(FGS_EnumAirportType::VALUE_CIVIL);
        $flightSpecification->setAlternateAirport2($alternate2Airport);

        if (isset($routeToAlternate2) && $routeToAlternate2 != "") {
            $route = new FGS_StructRoute();
            $route->setATCroute($routeToAlternate2);
            $flightSpecification->setRouteToAlternate2($route);
        }
    }

    $sIDSTAROptions = new FGS_StructFlightCalculationSIDSTAROptions();
    $sIDSTAROptions->setForceUseOfProceduresIfAvailable(TRUE);
    $sIDSTAROptions->setFullSIDSTARCalculation(TRUE);

    $calculationOptions = new FGS_StructFlightCalculationOptions();
    $calculationOptions->setSIDSTAROptions($sIDSTAROptions);

    $flightSpecification->setCalculationOptions($calculationOptions);
    //$flightSpecification->setWinds(new FGS_StructFixedWinds(1));
    $flightSpecification->setIncludeTCD(TRUE);


    $crewBriefingIntegrationDetails = new FGS_StructCrewBriefingIntegrationDetails();

    $flightCalculationRequest = new FGS_StructFlightCalculationRequest(NULL, $flightSpecification);
    $flightCalculationRequest->setAccountId(0);
    $flightCalculationRequest->setPassword('hidden');
    $flightCalculationRequest->setUserName('hidden');

    $calculateFlight = new FGS_StructCalculateFlightPlan($flightCalculationRequest);

    if($serviceCalculate->CalculateFlightPlan($calculateFlight))
    {
        $waypoints = '';
        file_put_contents('aax.xml', $serviceCalculate->getLastRequest());
        $estimatedDistance = $serviceCalculate->getResult()->getCalculateFlightPlanResult()->getFlightData()->getFlightDistances()->getDistanceToDestination()->getValue();
        //$estimatedDistance = $serviceCalculate->getResult()->getCalculateFlightResult()->getFlightDistances()->getDistanceToDestination()->getValue();
        $estimatedTime = $serviceCalculate->getResult()->getCalculateFlightPlanResult()->getFlightData()->getFlightTimes()->getTimeToDestination()->getValue() / 60;
        //$estimatedTime = $serviceCalculate->getResult()->getCalculateFlightResult()->getFlightTimes()->getTimeToDestination()->getValue() / 60;

        $dataPoints = $serviceCalculate->getResult()->getCalculateFlightPlanResult()->getFlightData()->getPathwayData()->getDestinationData()->getDataPoint();
        //$dataPoints = $serviceCalculate->getResult()->getCalculateFlightResult()->getPathwayData()->getDestinationData()->getDataPoint();
        foreach ($dataPoints as $dataPoint)
        {
            $waypoints .= $dataPoint->getWaypointData()->getWaypointId() . ';';
            $waypoints .= $dataPoint->getWaypointData()->getLatitude() . ';';
            $waypoints .= $dataPoint->getWaypointData()->getLongitude() . ';|';
        }
        return rtrim($waypoints, '|')."*****". $estimatedDistance."*****". $estimatedTime."*****".$serviceCalculate->getLastResponse();
    }
    else
        file_put_contents('bbx.xml', $serviceCalculate->getLastRequest()); //return null;//return($serviceCalculate->getLastRequest());
}

GenerateFlightPlan("N0430F450 BASUM3A BASUM UM170 NOR DCT LIMGO UN852 MOROK UZ24 BOLGI UN852 MILPA", "E55P", "EDDW", "LFLY", NULL, NULL, "2015-09-17T16:00:00", 350, 450, NULL, NULL);

And new code :

<?php

include 'loader.php';

function GenerateFlightPlan($route, $aircraftICAO, $depICAO, $desICAO, $altn1ICAO, $altn2ICAO, $date, $flightLevel, $trafficLoad, $routeToAlternate1, $routeToAlternate2)
{
    $wsdl = array (
        \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => 'https://testservices.aviationcloud.aero/FlightGenerationService.svc?wsdl',
        \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => \FGS\ClassMap::get (),
        \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_SOAP_VERSION => 1,
        \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_TRACE => TRUE );

    $serviceCalculate = new \FGS\Service\Calculate ( $wsdl );

    $paxNb = 1;
    $paxMassValue = $trafficLoad;

    $totalWeight = new \FGS\Struct\Weight();
    $totalWeight->setUnit(\FGS\Enum\WeightUnit::VALUE_KILOGRAM);
    $totalWeight->setValue($paxMassValue);

    $paxLoad = new \FGS\Struct\UnspecifiedPaxTypeLoad();
    $paxLoad->setNumberOfPax($paxNb);
    $paxLoad->setTotalWeight($totalWeight);

    $paxLoadSpecification = new \FGS\Struct\SimplePaxLoadSpecification();
    $paxLoadSpecification->setEnableAutoLuggage(FALSE);
    $paxLoadSpecification->setPaxLoad($paxLoad);

    $flightSpecification = new \FGS\Struct\FlightSpecification();

    $aircraftDefinition = new \FGS\Struct\ICAOIdentAircraftSpecification();
    $aircraftDefinition->setFuelBias(-10);
    $aircraftDefinition->setICAOIdent($aircraftICAO);
    $aircraftDefinition->setPreferedDataLevel(\FGS\Enum\DataLevel::VALUE_GLOBAL);
    $aircraftDefinition->setSpeedBias(0);

    $departureAirport = new \FGS\Struct\Airport();
    $departureAirport->setICAOCode($depICAO);
    $departureAirport->setIsAirportOfEntry(FALSE);
    $departureAirport->setSupportsIFR(FALSE);
    $departureAirport->setType(\FGS\Enum\AirportType::VALUE_CIVIL);

    $destinationAirport = new \FGS\Struct\Airport();
    $destinationAirport->setICAOCode($desICAO);
    $destinationAirport->setIsAirportOfEntry(FALSE);
    $destinationAirport->setMagneticVariation(0);
    $destinationAirport->setSupportsIFR(FALSE);
    $destinationAirport->setType(\FGS\Enum\AirportType::VALUE_CIVIL);

    $initialSpeed = new \FGS\Struct\Speed();
    $initialSpeed->setUnit(\FGS\Enum\SpeedUnit::VALUE_KNOTS);
    $initialSpeed->setValue(0);

    $routeToDestination = new \FGS\Struct\Route();
    //$routeToDestination->setFlightLevel($flightLevel);
    $routeToDestination->setInitialSpeed($initialSpeed);
    $routeToDestination->setATCroute($route);

    $upperBound = 150;
    $lowerBound = 0;

    $optimumflightLevelDefinition = new \FGS\Struct\OptimumFlightLevelDefinition();
    $optimumflightLevelDefinition->setLowerBound ( $lowerBound );
    $optimumflightLevelDefinition->setUpperBound ( $upperBound );

    $flightSpecification->setAircraftDefinition($aircraftDefinition);   
    $flightSpecification->setDepartureAirport($departureAirport);
    $flightSpecification->setDestinationAirport($destinationAirport);
    $flightSpecification->setIsETOPSFlight(FALSE);
    $flightSpecification->setRouteToDestination($routeToDestination);
    $flightSpecification->setScheduledTimeOfDeparture($date);
    $flightSpecification->setPaxLoadSpecification($paxLoadSpecification);
    $flightSpecification->setFlightLevelDefinition($optimumflightLevelDefinition);

    if ( isset($altn1ICAO) && $altn1ICAO != "" )
    {
        $alternate1Airport = new \FGS\Struct\Airport();
        $alternate1Airport->setICAOCode($altn1ICAO);
        $alternate1Airport->setIsAirportOfEntry(FALSE);
        $alternate1Airport->setMagneticVariation(0);
        $alternate1Airport->setSupportsIFR(FALSE);
        $alternate1Airport->setType(\FGS\Enum\AirportType::VALUE_CIVIL);
        $flightSpecification->setAlternateAirport1($alternate1Airport);

        if (isset($routeToAlternate1) && $routeToAlternate1 != "") {
            $route = new \FGS\Struct\Route();
            $route->setATCroute($routeToAlternate1);
            $flightSpecification->setRouteToAlternate1($route);
        }
    }

    if ( isset($altn2ICAO) && $altn2ICAO != "" )
    {
        $alternate2Airport = new \FGS\Struct\Airport();
        $alternate2Airport->setICAOCode($altn2ICAO);
        $alternate2Airport->setIsAirportOfEntry(FALSE);
        $alternate2Airport->setMagneticVariation(0);
        $alternate2Airport->setSupportsIFR(FALSE);
        $alternate2Airport->setType(\FGS\Enum\AirportType::VALUE_CIVIL);
        $flightSpecification->setAlternateAirport2($alternate2Airport);

        if (isset($routeToAlternate2) && $routeToAlternate2 != "") {
            $route = new FGS_StructRoute();
            $route->setATCroute($routeToAlternate2);
            $flightSpecification->setRouteToAlternate2($route);
        }
    }

    $sIDSTAROptions = new \FGS\Struct\FlightCalculationSIDSTAROptions();
    $sIDSTAROptions->setForceUseOfProceduresIfAvailable(TRUE);
    $sIDSTAROptions->setFullSIDSTARCalculation(TRUE);

    $calculationOptions = new \FGS\Struct\FlightCalculationOptions();
    $calculationOptions->setSIDSTAROptions($sIDSTAROptions);

    $flightSpecification->setCalculationOptions($calculationOptions);
    //$flightSpecification->setWinds(new FGS_StructFixedWinds(1));
    $flightSpecification->setIncludeTCD(TRUE);


    $crewBriefingIntegrationDetails = new FGS\Struct\CrewBriefingIntegrationDetails();

    $flightCalculationRequest = new \FGS\Struct\FlightCalculationRequest(NULL, $flightSpecification);   
    $flightCalculationRequest->setAccountId(0);
    $flightCalculationRequest->setPassword('hidden');
    $flightCalculationRequest->setUserName('hidden');

    $calculateFlight = new \FGS\Struct\CalculateFlightPlan($flightCalculationRequest);

    //die("##" .$calculateFlight->getRequest()->getFlightSpecification()->getAircraftDefinition()->_get('ICAOIdent'));

    if($serviceCalculate->CalculateFlightPlan($calculateFlight))
    {
        $waypoints = '';
        file_put_contents('aaa.xml', $serviceCalculate->getLastRequest());
        $estimatedDistance = $serviceCalculate->getResult()->getCalculateFlightPlanResult()->getFlightData()->getFlightDistances()->getDistanceToDestination()->getValue();
        //$estimatedDistance = $serviceCalculate->getResult()->getCalculateFlightResult()->getFlightDistances()->getDistanceToDestination()->getValue();
        $estimatedTime = $serviceCalculate->getResult()->getCalculateFlightPlanResult()->getFlightData()->getFlightTimes()->getTimeToDestination()->getValue() / 60;
        //$estimatedTime = $serviceCalculate->getResult()->getCalculateFlightResult()->getFlightTimes()->getTimeToDestination()->getValue() / 60;

        $dataPoints = $serviceCalculate->getResult()->getCalculateFlightPlanResult()->getFlightData()->getPathwayData()->getDestinationData()->getDataPoint();
        //$dataPoints = $serviceCalculate->getResult()->getCalculateFlightResult()->getPathwayData()->getDestinationData()->getDataPoint();
        foreach ($dataPoints as $dataPoint)
        {
            $waypoints .= $dataPoint->getWaypointData()->getWaypointId() . ';';
            $waypoints .= $dataPoint->getWaypointData()->getLatitude() . ';';
            $waypoints .= $dataPoint->getWaypointData()->getLongitude() . ';|';
        }
        return rtrim($waypoints, '|')."*****". $estimatedDistance."*****". $estimatedTime."*****".$serviceCalculate->getLastResponse();
    }
    else
        file_put_contents('bbb.xml', $serviceCalculate->getLastRequest()); //return null;//return($serviceCalculate->getLastRequest());
}

GenerateFlightPlan("N0430F450 BASUM3A BASUM UM170 NOR DCT LIMGO UN852 MOROK UZ24 BOLGI UN852 MILPA", "E55P", "EDDW", "LFLY", NULL, NULL, "2015-09-17T16:00:00", 350, 450, NULL, NULL);

Regards,

Naming. Class _Add and method _add_1/2/3... names. Need to minify reserved_keywords.yml

class _Add extends AbstractSoapClientBase

public function _add_3(\AppBundle\Provider\YandexDirect\Campaigns\StructType\AddRequest $parameters)

* Method to call the operation originally named add

I found this changes and this #46
But I did not understand, why do we need this?

class Add and method add() works well. I checked it. Such as many other words in reserved_keywords.yml that can be used as class name, like the First.

// PHP 5.6

Importing xsd into another xsd causing a problem

We have two xsd files which have same named complexTypes in them. One of them is defined as abstract, the other one is not. We are using xsd files like as below:

a.xsd

...
<complexType name="Campaign" abstract="true">
...

b.xsd

...
<import schemaLocation="a.xsd" namespace="http://foo.com/xmlschema/a" />
...
<complexType name="Campaign">
...
<element name="getCampaignsResponse">
    <complexType>
        <sequence>
            <element name="campaigns" type="b:Campaign" minOccurs="0" maxOccurs="unbounded" />
        </sequence>
    </complexType>
</element>

When we use PackageGenerator on b.wsdl, it gives an output of a.wsld's Campaign complexType which called StructCampaign.php. How can we solve this issue? Can we give an option which makes PackageGenerator handle this problem.

Support for SSL Context Options

Hi,

thank you for maintaining this project. It's very useful.

Would it be possible to provide additional Options for the SSL Context like verify_peer, ca_file and ca_path mentioned in http://php.net/manual/de/context.ssl.php.
Currently I have some problems to generate Code for WSDLs which are hosted under https with self-signed certificates or with CAs which are not in my trust-chain

Invalid value returned by AbstractTagImport::getLocationAttribute()

Issue

When getting the value of the attribute schemaLocation or location, if the value starts with http://, we only get the value after :// => //.
This is due to the fact that by default AbstractAttributeHandler::getValue() returns the attribute value without the namespace which is suffixed by :.

How to fix

When calling AbstractAttributeHandler::getValue(), true must be passed as first argument to avoid namespace handling.

Generated ClassMap::classMap can not be static

PHP believes that the generated method ClassMap::classMap is an "old style" constructor and therefore cannot be static.

I believe this gives further support in the disambiguation of ClassMap mentioned in here

Stack Trace:

PHP Fatal error:  Constructor ClassMap::classMap() cannot be static in /Users/hwood/sandbox/wsdltophp/vendor/wsdltophp/packagegenerator/code/ClassMap.php on line 30
PHP Stack trace:
PHP   1. {main}() /Users/hwood/sandbox/wsdltophp/vendor/wsdltophp/packagegenerator/console:0
PHP   2. Symfony\Component\Console\Application->run() /Users/hwood/sandbox/wsdltophp/vendor/wsdltophp/packagegenerator/console:14
PHP   3. Symfony\Component\Console\Application->doRun() /Users/hwood/sandbox/wsdltophp/vendor/symfony/console/Application.php:126
PHP   4. Symfony\Component\Console\Application->doRunCommand() /Users/hwood/sandbox/wsdltophp/vendor/symfony/console/Application.php:195
PHP   5. Symfony\Component\Console\Command\Command->run() /Users/hwood/sandbox/wsdltophp/vendor/symfony/console/Application.php:878
PHP   6. WsdlToPhp\PackageGenerator\Command\GeneratePackageCommand->execute() /Users/hwood/sandbox/wsdltophp/vendor/symfony/console/Command/Command.php:259
PHP   7. WsdlToPhp\PackageGenerator\Generator\Generator->generateClasses() /Users/hwood/sandbox/wsdltophp/vendor/wsdltophp/packagegenerator/Command/GeneratePackageCommand.php:101
PHP   8. WsdlToPhp\PackageGenerator\Generator\Generator->generateTutorialFile() /Users/hwood/sandbox/wsdltophp/vendor/wsdltophp/packagegenerator/Generator/Generator.php:234
PHP   9. require_once() /Users/hwood/sandbox/wsdltophp/vendor/wsdltophp/packagegenerator/Generator/Generator.php:565

My PHP version:

HP 5.5.20 (cli) (built: Feb 25 2015 23:30:53)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans

Application not found

Fatal error: Class 'Composer\Console\Application' not found in PATH/PackageGenerator/Generator/Generator.php on line 345

Global sanity checks for more flexibility

User should be able to customize as much as possible its generated package.

At least, the options that should be define should be:

  • the WSDL path
  • the generated package destination
  • the composer name

It means that these options should be optional:

  • prefix
  • suffix
  • namespace
  • etc

It's up to the user to determine if the generated classes must be prefixed/suffixed in the case of PHP used revserved keywords.

PHP warning on str_repeat()

Few PHP warnings pop up when I run console wsdltophp:generate:package -h

after line output
-wsdl-prox-lo, --wsdl-proxy-login[=WSDL-PROXY-LOGIN] Use proxy login

I see
PHP Warning: str_repeat(): Second argument has to be greater than or equal to 0 in /Users/jaan/Sites/PackageGenerator/vendor/symfony/console/Descriptor/TextDescriptor.php on line 82

PHP version:
php -v
PHP 5.5.20 (cli) (built: Feb 25 2015 23:30:53) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.