getSoapTypes() public method

Retrieve SOAP types from the WSDL and parse them
public getSoapTypes ( ) : array
return array Array of types and their properties
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $destination = rtrim($input->getArgument('destination'), '/\\');
     if (!$this->filesystem->dirextoryExists($destination)) {
         throw new RunTimeException(sprintf('The destination %s does not exist.', $destination));
     }
     $wsdl = $input->getOption('wsdl');
     if (!$wsdl) {
         throw new RuntimeException('You MUST specify a WSDL endpoint.');
     }
     $namespace = $input->getOption('namespace');
     $soapClient = new SoapClient($wsdl, []);
     $types = $soapClient->getSoapTypes();
     $functions = $soapClient->getSoapFunctions();
     $generator = new TypeGenerator($namespace);
     foreach ($types as $type => $properties) {
         // Check if file exists:
         $file = sprintf('%s/%s.php', $destination, ucfirst($type));
         $data = $generator->generate($type, $properties, $functions);
         // Existing files ...
         if ($this->filesystem->fileExists($file)) {
             $output->write(sprintf('Client class %s exists. Trying to patch ...', $type));
             $this->handleExistingFile($input, $output, $file, $type, $data);
             continue;
         }
         // New files...
         $this->filesystem->putFileContents($file, $data);
         $output->writeln(sprintf('Generated class %s to %s', $type, $file));
     }
     $output->writeln('Done');
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $wsdl = $input->getOption('wsdl');
     if (!$wsdl) {
         throw new RuntimeException('You MUST specify a WSDL endpoint.');
     }
     $namespace = $input->getOption('namespace');
     $soapClient = new SoapClient($wsdl, []);
     $types = $soapClient->getSoapTypes();
     $generator = new ClassmapGenerator($namespace);
     $output->write($generator->generate($types));
 }
Example #3
0
 /**
  * @test
  */
 function it_should_know_all_WSDL_types()
 {
     $types = $this->client->getSoapTypes();
     $this->assertTrue(array_key_exists('GetCityForecastByZIP', $types));
     $this->assertEquals('string', $types['GetCityForecastByZIP']['ZIP']);
 }
Example #4
0
 /**
  * @param string     $namespace
  * @param SoapClient $client
  *
  * @return TypeMap
  */
 public static function fromSoapClient($namespace, SoapClient $client)
 {
     return new self($namespace, $client->getSoapTypes());
 }