Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request objects generated using the wizard are not extending their base classes #144

Closed
ghost opened this issue Feb 26, 2018 · 4 comments
Closed
Labels

Comments

@ghost
Copy link

ghost commented Feb 26, 2018

See title.

I've been trying to generate a client using the following WSDL: https://onlineavl2svc-uk.navmanwireless.com/OnlineAVL/API/V2.1/Service.asmx?wsdl using the wizard option as defined in the README.md

However after generation the generated classes do not extend their correct base message class, which obviously results in some errors.

I'm not sure what i could do to change this, did i miss a setting somewhere? Some guidance would be nice!

Thanks in advance! 👍

@veewee
Copy link
Contributor

veewee commented Feb 27, 2018

Hi @btfo,

Can you at least share the generated config file?
The wizard tool is there to generate a basic set-up. This means that it might not work for your soap service instantly. If you want classes to extend from another class, then you'll have to create a rule for this. This package can't automatically know what to extend.

You probably want to read up on rules and assemblers at this point:
https://github.com/phpro/soap-client/blob/master/docs/code-generation/rules.md
https://github.com/phpro/soap-client/blob/master/docs/code-generation/assemblers.md

@ghost
Copy link
Author

ghost commented Feb 27, 2018

Hello @veewee!

The following would be my configuration as generated by the Wizard.

<?php

use Phpro\SoapClient\CodeGenerator\Assembler;
use Phpro\SoapClient\CodeGenerator\Rules;
use Phpro\SoapClient\CodeGenerator\Config\Config;

return Config::create()
    ->setWsdl('https://onlineavl2svc-uk.navmanwireless.com/OnlineAVL/API/V2.1/Service.asmx?wsdl')
    ->setTypeDestination('NavSDK/Type')
    ->setTypeNamespace('app\Type')
    ->setClientDestination('NavSDK')
    ->setClientName('NavSDKClient')
    ->setClientNamespace('app')
    ->setClassMapDestination('NavSDK')
    ->setClassMapName('NavSDKClassmap')
    ->setClassMapNamespace('app')
    ->addRule(new Rules\AssembleRule(new Assembler\GetterAssembler(new Assembler\GetterAssemblerOptions())))
    ->addRule(new Rules\AssembleRule(new Assembler\ImmutableSetterAssembler()))
    ->addRule(
        new Rules\TypenameMatchesRule(
            new Rules\MultiRule([
                new Rules\AssembleRule(new Assembler\RequestAssembler()),
                new Rules\AssembleRule(new Assembler\ConstructorAssembler()),
            ]),
            '/(?<!Response)$/i'
        )
    )
    ->addRule(
        new Rules\TypenameMatchesRule(
            new Rules\MultiRule([
                new Rules\AssembleRule(new Assembler\ResultAssembler()),
            ]),
            '/Response$/i'
        )
    )
;

So if i understand this correctly, i would have to utilize the ExtendAssembler in combination with the rules to get the generation to properly extend the classes, yeah?

@janvernieuwe
Copy link
Member

@btfo that is correct, the wizard is meanly meanth to generate the basics.
So you'd need to tweak the config manually

@veewee
Copy link
Contributor

veewee commented Oct 28, 2022

Hello,

We noticed this issue got reported many times and want to tackle it at its core!
Therefore, we've planned a project that will work on better types support.
It’s going to be a huge project, so we are looking for ways to make development possible during our business hours instead of in our developers precious spare time.

In case you want this feature as badly as us: find out how you can support this project here 💚!

@veewee veewee mentioned this issue Apr 3, 2023
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants