-
-
Notifications
You must be signed in to change notification settings - Fork 175
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
Expected "non-empty-string", got "string" #506
Comments
i have the same issue. trying to use the following WSDL,
trying to run the wizard gives me the error above mentioned |
im disabled to type 'non-empty-string' check and wizard all done in file NonEmptyStringType.php comment all thing that inner assert method and just return value from method. this will disable check type and wizard can go forward |
Disabling the non-empty-string sounds like a very bad idea to be honest. Feel free to provide more information, like WSDL. Configs,... so that it can be investigated further. It might be all separate issues as well. One known issue that results in a non-empty-string situation is this one: A PR that fixes that specific issue is linked and can be tested on your project as well. It might be the same. I'm a bit busy the next days so I might not be able to provide a fast solution ATM. |
but in the other way if dont disable checking a non-empty-string i've give a exception and thats all. wizard stops with exception and not be able to generate separately types or classmap |
Unfortuantly that does not work either. im using the following config <?php
use Phpro\SoapClient\CodeGenerator\Assembler;
use Phpro\SoapClient\CodeGenerator\Rules;
use Phpro\SoapClient\CodeGenerator\Config\Config;
use Soap\ExtSoapEngine\ExtSoapOptions;
use Phpro\SoapClient\Soap\CodeGeneratorEngineFactory;
return Config::create()
->setEngine($engine = CodeGeneratorEngineFactory::create(
'https://tst.itserve.ch/swissdec/refapps/next/receiver/services/SalaryDeclarationService20200220?wsdl'
))
->setTypeDestination('src/Type')
->setTypeNamespace('App\Type')
->setClientDestination('src\client')
->setClientName('SwissdecClient')
->setClientNamespace('App\Client')
->setClassMapDestination('src\classmap')
->setClassMapName('SwissdecClassmap')
->setClassMapNamespace('App\Classmap')
->addRule(new Rules\AssembleRule(new Assembler\GetterAssembler(
(new Assembler\GetterAssemblerOptions())->withDocBlocks(true)
)))
->addRule(new Rules\AssembleRule(new Assembler\ImmutableSetterAssembler(
(new Assembler\ImmutableSetterAssemblerOptions())->withDocBlocks(true)
)))
->addRule(
new Rules\IsRequestRule(
$engine->getMetadata(),
new Rules\MultiRule([
new Rules\AssembleRule(new Assembler\RequestAssembler()),
new Rules\AssembleRule(new Assembler\ConstructorAssembler(
(new Assembler\ConstructorAssemblerOptions())->withDocBlocks(true)
)),
])
)
)
->addRule(
new Rules\IsResultRule(
$engine->getMetadata(),
new Rules\MultiRule([
new Rules\AssembleRule(new Assembler\ResultAssembler()),
])
)
)
->addRule(
new Rules\IsExtendingTypeRule(
$engine->getMetadata(),
new Rules\AssembleRule(new Assembler\ExtendingTypeAssembler())
)
)
->addRule(
new Rules\IsAbstractTypeRule(
$engine->getMetadata(),
new Rules\AssembleRule(new Assembler\AbstractClassAssembler())
)
)
; This is on an entierly new Project. (composer.json) {
"require": {
"php-soap/psr18-wsse-middleware": "^2.3",
"symfony/http-client": "^6.4",
"nyholm/psr7": "^1.8",
"phpro/soap-client": "^3.1"
},
"config": {
"allow-plugins": {
"php-http/discovery": true
}
}
} |
The problem in this WSDL is: <xs:simpleType name="EmptySimpleType">
<xs:restriction base="xs:string">
<xs:enumeration value=""/>
</xs:restriction>
</xs:simpleType> Whilst, our meta class says: /**
* @throws CoercionException
*/
public function withEnums(?array $enums): self
{
$new = clone $this;
$new->enums = optional(vec(non_empty_string()))->coerce($enums);
return $new;
} So the fix lies in reworking |
@blessq12 you got any wsdl to share so that I can see what is going wrong there as well? |
@veewee sure ive got one and so much troubles how to use it normal
when i disable check type ( when i get an exception with non-empty-string ) the wizard generate all file that i need to create a request to smev system but not it's return an SOAP-ERROR: Encoding: object has no 'any' property and just one another question, can your lib to sign an part of envelope? i need to create an envelope and sign one part of it |
@veewee Thank you for looking into it. |
@blessq12, I've investigated the WSDL and it's the same issue I linked above. When I apply that patch, It is able to generate the types. However I do see one additional issue:
This is due to:
For signing parts of the envelope, you can use: |
I made PRs in the various sections where things went wrong.
You should be able to generate the types now given the WSDL you provided me. If you like the work we provide here: feel free to sponsor us. |
Originally posted by @blessq12 in #504 (comment)
The text was updated successfully, but these errors were encountered: