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

"No SOAP type found with name any" exception thrown when performing a request #559

Closed
cetetesoft opened this issue Nov 14, 2024 · 3 comments · Fixed by #560
Closed

"No SOAP type found with name any" exception thrown when performing a request #559

cetetesoft opened this issue Nov 14, 2024 · 3 comments · Fixed by #560

Comments

@cetetesoft
Copy link

Bug Report

Q A
BC Break yes/no
Version 4.0.0-alpha3

Summary

On a fresh install, I've generated the required files with vendor/bin/soap-client wizard. When doing a test request, a MetadataException is thrown.

The WSDL is:
https://prewww2.aeat.es/static_files/common/internet/dep/aplicaciones/es/aeat/tikeV1.0/cont/ws/SistemaFacturacion.wsdl

Current behavior

Here's the full stack trace:

PHP Fatal error:  Uncaught Soap\Engine\Exception\MetadataException: No SOAP type found with name any. in C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\engine\src\Exception\MetadataException.php:11
Stack trace:
#0 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\engine\src\Metadata\Collection\TypeCollection.php(118): Soap\Engine\Exception\MetadataException::typeNotFound('any')
#1 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\TypeInference\ComplexTypeBuilder.php(23): Soap\Engine\Metadata\Collection\TypeCollection->fetchByNameAndXmlNamespace('any', '')
#2 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\ObjectAccess.php(36): Soap\Encoding\TypeInference\ComplexTypeBuilder->__invoke(Object(Soap\Encoding\Encoder\Context))
#3 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\ObjectEncoder.php(45): Soap\Encoding\Encoder\ObjectAccess::forContext(Object(Soap\Encoding\Encoder\Context))
#4 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\ErrorHandlingEncoder.php(32): Soap\Encoding\Encoder\ObjectEncoder->iso(Object(Soap\Encoding\Encoder\Context))
#5 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\ObjectAccess.php(96): Soap\Encoding\Encoder\ErrorHandlingEncoder->iso(Object(Soap\Encoding\Encoder\Context))
#6 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\ObjectAccess.php(58): Soap\Encoding\Encoder\ObjectAccess::grabIsoForProperty(Object(Soap\Encoding\Encoder\Context), Object(Soap\Engine\Metadata\Model\Property))
#7 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\ObjectEncoder.php(45): Soap\Encoding\Encoder\ObjectAccess::forContext(Object(Soap\Encoding\Encoder\Context))
#8 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\OptionalElementEncoder.php(33): Soap\Encoding\Encoder\ObjectEncoder->iso(Object(Soap\Encoding\Encoder\Context))
#9 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\ErrorHandlingEncoder.php(32): Soap\Encoding\Encoder\OptionalElementEncoder->iso(Object(Soap\Encoding\Encoder\Context))
#10 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\ObjectAccess.php(96): Soap\Encoding\Encoder\ErrorHandlingEncoder->iso(Object(Soap\Encoding\Encoder\Context))
#11 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\ObjectAccess.php(58): Soap\Encoding\Encoder\ObjectAccess::grabIsoForProperty(Object(Soap\Encoding\Encoder\Context), Object(Soap\Engine\Metadata\Model\Property))
#12 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\ObjectEncoder.php(45): Soap\Encoding\Encoder\ObjectAccess::forContext(Object(Soap\Encoding\Encoder\Context))
#13 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\OptionalElementEncoder.php(33): Soap\Encoding\Encoder\ObjectEncoder->iso(Object(Soap\Encoding\Encoder\Context))
#14 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\ErrorHandlingEncoder.php(32): Soap\Encoding\Encoder\OptionalElementEncoder->iso(Object(Soap\Encoding\Encoder\Context))
#15 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\ObjectAccess.php(96): Soap\Encoding\Encoder\ErrorHandlingEncoder->iso(Object(Soap\Encoding\Encoder\Context))
#16 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\ObjectAccess.php(58): Soap\Encoding\Encoder\ObjectAccess::grabIsoForProperty(Object(Soap\Encoding\Encoder\Context), Object(Soap\Engine\Metadata\Model\Property))
#17 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\ObjectEncoder.php(45): Soap\Encoding\Encoder\ObjectAccess::forContext(Object(Soap\Encoding\Encoder\Context))
#18 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\OptionalElementEncoder.php(33): Soap\Encoding\Encoder\ObjectEncoder->iso(Object(Soap\Encoding\Encoder\Context))
#19 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\ErrorHandlingEncoder.php(32): Soap\Encoding\Encoder\OptionalElementEncoder->iso(Object(Soap\Encoding\Encoder\Context))
#20 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\ObjectAccess.php(96): Soap\Encoding\Encoder\ErrorHandlingEncoder->iso(Object(Soap\Encoding\Encoder\Context))
#21 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\ObjectAccess.php(58): Soap\Encoding\Encoder\ObjectAccess::grabIsoForProperty(Object(Soap\Encoding\Encoder\Context), Object(Soap\Engine\Metadata\Model\Property))
#22 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\ObjectEncoder.php(45): Soap\Encoding\Encoder\ObjectAccess::forContext(Object(Soap\Encoding\Encoder\Context))
#23 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\OptionalElementEncoder.php(33): Soap\Encoding\Encoder\ObjectEncoder->iso(Object(Soap\Encoding\Encoder\Context))
#24 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\ErrorHandlingEncoder.php(32): Soap\Encoding\Encoder\OptionalElementEncoder->iso(Object(Soap\Encoding\Encoder\Context))
#25 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\ObjectAccess.php(96): Soap\Encoding\Encoder\ErrorHandlingEncoder->iso(Object(Soap\Encoding\Encoder\Context))
#26 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\ObjectAccess.php(58): Soap\Encoding\Encoder\ObjectAccess::grabIsoForProperty(Object(Soap\Encoding\Encoder\Context), Object(Soap\Engine\Metadata\Model\Property))
#27 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\ObjectEncoder.php(45): Soap\Encoding\Encoder\ObjectAccess::forContext(Object(Soap\Encoding\Encoder\Context))
#28 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\OptionalElementEncoder.php(33): Soap\Encoding\Encoder\ObjectEncoder->iso(Object(Soap\Encoding\Encoder\Context))
#29 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\RepeatingElementEncoder.php(33): Soap\Encoding\Encoder\OptionalElementEncoder->iso(Object(Soap\Encoding\Encoder\Context))
#30 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\ErrorHandlingEncoder.php(32): Soap\Encoding\Encoder\RepeatingElementEncoder->iso(Object(Soap\Encoding\Encoder\Context))
#31 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\ObjectAccess.php(96): Soap\Encoding\Encoder\ErrorHandlingEncoder->iso(Object(Soap\Encoding\Encoder\Context))
#32 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\ObjectAccess.php(58): Soap\Encoding\Encoder\ObjectAccess::grabIsoForProperty(Object(Soap\Encoding\Encoder\Context), Object(Soap\Engine\Metadata\Model\Property))
#33 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\ObjectEncoder.php(45): Soap\Encoding\Encoder\ObjectAccess::forContext(Object(Soap\Encoding\Encoder\Context))
#34 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\OptionalElementEncoder.php(33): Soap\Encoding\Encoder\ObjectEncoder->iso(Object(Soap\Encoding\Encoder\Context))
#35 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder\ErrorHandlingEncoder.php(32): Soap\Encoding\Encoder\OptionalElementEncoder->iso(Object(Soap\Encoding\Encoder\Context))
#36 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Xml\Writer\ParameterBuilder.php(68): Soap\Encoding\Encoder\ErrorHandlingEncoder->iso(Object(Soap\Encoding\Encoder\Context))
#37 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Xml\Writer\ParameterBuilder.php(51): Soap\Encoding\Xml\Writer\ParameterBuilder->encode(Object(Soap\Encoding\Encoder\Context))
#38 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Xml\Writer\ParameterBuilder.php(33): Soap\Encoding\Xml\Writer\ParameterBuilder->buildDocument(Object(XMLWriter))
#39 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\veewee\xml\src\Xml\Writer\Builder\children.php(24): Soap\Encoding\Xml\Writer\ParameterBuilder->__invoke(Object(XMLWriter))
#40 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Xml\Writer\OperationBuilder.php(45): VeeWee\Xml\Writer\Builder\{closure}(Object(XMLWriter))
#41 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Xml\Writer\OperationBuilder.php(36): Soap\Encoding\Xml\Writer\OperationBuilder->buildDocument(Object(XMLWriter))
#42 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\veewee\xml\src\Xml\Writer\Builder\children.php(24): Soap\Encoding\Xml\Writer\OperationBuilder->__invoke(Object(XMLWriter))
#43 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\veewee\xml\src\Xml\Writer\Builder\namespaced_element.php(25): VeeWee\Xml\Writer\Builder\{closure}(Object(XMLWriter))
#44 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\veewee\xml\src\Xml\Writer\Builder\namespaced_element.php(25): VeeWee\Xml\Writer\Builder\{closure}(Object(XMLWriter))
#45 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\veewee\xml\src\Xml\Writer\Writer.php(76): VeeWee\Xml\Writer\Builder\{closure}(Object(XMLWriter))
#46 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\azjezz\psl\src\Psl\Result\wrap.php(23): VeeWee\Xml\Writer\Writer::VeeWee\Xml\Writer\{closure}()
#47 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\veewee\xml\src\Xml\ErrorHandling\detect_issues.php(31): Psl\Result\wrap(Object(Closure))
#48 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\veewee\xml\src\Xml\ErrorHandling\disallow_issues.php(20): VeeWee\Xml\ErrorHandling\detect_issues(Object(Closure))
#49 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\veewee\xml\src\Xml\Writer\Writer.php(74): VeeWee\Xml\ErrorHandling\disallow_issues(Object(Closure))
#50 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Xml\Writer\SoapEnvelopeWriter.php(49): VeeWee\Xml\Writer\Writer->write(Object(Closure))
#51 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Encoder.php(51): Soap\Encoding\Xml\Writer\SoapEnvelopeWriter->__invoke()
#52 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\encoding\src\Driver.php(67): Soap\Encoding\Encoder->encode('RegFactuSistema...', Array)
#53 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\engine\src\SimpleEngine.php(24): Soap\Encoding\Driver->encode('RegFactuSistema...', Array)
#54 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\php-soap\engine\src\LazyEngine.php(28): Soap\Engine\SimpleEngine->request('RegFactuSistema...', Array)
#55 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\phpro\soap-client\src\Phpro\SoapClient\Caller\EngineCaller.php(27): Soap\Engine\LazyEngine->request('RegFactuSistema...', Array)
#56 C:\Users\Public\Desktop\soap\test-4-alpha\vendor\phpro\soap-client\src\Phpro\SoapClient\Caller\EventDispatchingCaller.php(30): Phpro\SoapClient\Caller\EngineCaller->__invoke('RegFactuSistema...', Object(v\Type\RegFactuSistemaFacturacion))
#57 C:\Users\Public\Desktop\soap\test-4-alpha\v\VerifactuClient.php(30): Phpro\SoapClient\Caller\EventDispatchingCaller->__invoke('RegFactuSistema...', Object(v\Type\RegFactuSistemaFacturacion))
#58 C:\Users\Public\Desktop\soap\test-4-alpha\test.php(25): v\VerifactuClient->regFactuSistemaFacturacion(Object(v\Type\RegFactuSistemaFacturacion))
#59 {main}

How to reproduce

  1. Create a new project with the following composer.json:
{
    "name": "cs/test",
    "require": {
      "phpro/soap-client": "4.0.0-alpha3",
      "symfony/cache": "*",
      "symfony/http-client": "7.2.x-dev",
      "nyholm/psr7": "^1.8@dev"
    },
    "autoload": {
        "psr-4": {
            "v\\": "v/"
        }
    },
    "config": {
        "allow-plugins": {
            "php-http/discovery": true
        }
    },
    "minimum-stability": "dev"
}
  1. Run vendor/bin/soap-client wizard:
  • WSDL: https://prewww2.aeat.es/static_files/common/internet/dep/aplicaciones/es/aeat/tikeV1.0/cont/ws/SistemaFacturacion.wsdl
  • Generic name: Verifactu
  • Directory: v
  • Namespace: v
  1. Create and run a test script:
<?php

use v\Type\CabeceraType;
use v\Type\PersonaFisicaJuridicaESType;
use v\Type\RegFactuSistemaFacturacion;
use v\Type\RegistroAlta;
use v\Type\RegistroFacturaType;
use v\VerifactuClient;
use v\VerifactuClientFactory;

require './vendor/autoload.php';

$url='https://prewww2.aeat.es/static_files/common/internet/dep/aplicaciones/es/aeat/tikeV1.0/cont/ws/SistemaFacturacion.wsdl';

$cliente=VerifactuClientFactory::factory($url);
$cabecera=new CabeceraType;

$cabecera=$cabecera->withObligadoEmision(
  (new PersonaFisicaJuridicaESType)
    ->withNIF('00000010T')
    ->withNombreRazon('XXX SL')
  );
$registro=new RegistroFacturaType;
$envio=new RegFactuSistemaFacturacion($cabecera,[$registro]);
$res=$cliente->regFactuSistemaFacturacion($envio);

var_dump($res);

Expected behavior

When using version 3, the behavior was the expected one, ie, it failed because the provided WSDL's first port has a wrong endpoint (see #557):
PHP Fatal error: Uncaught Symfony\Component\HttpClient\Exception\InvalidArgumentException: Invalid URL: scheme is missing in "xxxxxxxxxx". Did you forget to add "http(s)://"?

@veewee
Copy link
Contributor

veewee commented Nov 14, 2024

Thanks for reporting.

I think it is related to a recent change as a preparation for #533

It adds support for any element type in the goetas/xsd-reader package:
https://github.com/goetas-webservices/xsd-reader/releases/tag/0.4.7

This one isn't supported in here yet.

Does pinning that repo to 0.4.6 fix the issue for you in the meantime?

I'll try to take a deeper look and support for that any-type soon.

@cetetesoft
Copy link
Author

Yes, using version 0.4.6 of that package fixes the issue.

@veewee veewee mentioned this issue Dec 6, 2024
3 tasks
@veewee
Copy link
Contributor

veewee commented Dec 19, 2024

Hello There,

Just wanted to let you know that support was recently added to https://github.com/phpro/soap-client/releases/tag/4.0.0-alpha4 through #560.

Enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants