Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/Phpro/SoapClient/Console/Command/GenerateConfigCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,20 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$context->setWsdl($wsdlUri);

$io->warning('Attempting to load WSDL... (this might take a while)');
$wsdl = $this->loadWsdl($wsdlUri);

if (!$wsdl) {
try {
$wsdl = $this->loadWsdl($wsdlUri);
} catch (\Throwable $e) {
$io->warning('Could not load the provided WSDL with default engine options.');
$io->error([$e::class,$e->getMessage()]);
if ($output->isVeryVerbose()) {
$io->text(explode("\n", $e->getTraceAsString()));
}
$io->info('Continuing generating configuration...');
$wsdl = null;
}


$context->setDetectedXmlNamespaces($wsdl?->namespaces->namespaceToNameMap ?? []);
$context->setGenerateDocblocks($io->confirm('Should methods be generated with docblocks?', true));
$name = $io->ask(
Expand Down Expand Up @@ -107,15 +114,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return self::SUCCESS;
}

private function loadWsdl(string $wsdl): ?Wsdl1
private function loadWsdl(string $wsdl): Wsdl1
{
try {
$options = EngineOptions::defaults($wsdl);
$loader = $options->getWsdlLoader();

return (new Wsdl1Reader($loader))($wsdl);
} catch (\Throwable) {
return null;
}
}
}
Loading