protected function execute(InputInterface $input, OutputInterface $output) { $version = $input->getArgument('version') ?: '*'; $path = $input->getArgument('path'); $doc = $this->resourceListing->getDocumentation($path); if ($doc instanceof DocumentationInterface) { if ($version == '*') { $version = $doc->getLatestVersion(); } $resource = $doc->getResource($version); if (!$resource instanceof Resource) { throw new RuntimeException('Given version is not available'); } $targetNamespace = $this->config['psx_soap_namespace']; $generator = new Generator\Xsd($targetNamespace); $output->write($generator->generate($resource)); } else { throw new RuntimeException('Invalid resource'); } }
protected function appendTypes(DOMElement $element, Resource $resource) { $types = $element->ownerDocument->createElement('wsdl:types'); $schema = $element->ownerDocument->createElementNS('http://www.w3.org/2001/XMLSchema', 'xs:schema'); $schema->setAttribute('targetNamespace', $this->targetNamespace); $schema->setAttribute('elementFormDefault', 'qualified'); $schema->setAttribute('xmlns:tns', $this->targetNamespace); $xsdGenerator = new Xsd($this->targetNamespace); $xsdGenerator->appendSchema($schema, $resource); $types->appendChild($schema); $element->appendChild($types); }