diff --git a/composer.json b/composer.json index 3e68f25..054cc26 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "php-soap/engine": "^2.16", "php-soap/wsdl": "^1.14", "php-soap/xml": "^1.9", - "php-soap/wsdl-reader": "^0.27" + "php-soap/wsdl-reader": "^0.29" }, "require-dev": { "vimeo/psalm": "~6.13", diff --git a/src/Xml/Writer/XsiAttributeBuilder.php b/src/Xml/Writer/XsiAttributeBuilder.php index 1d62a41..639c397 100644 --- a/src/Xml/Writer/XsiAttributeBuilder.php +++ b/src/Xml/Writer/XsiAttributeBuilder.php @@ -39,6 +39,12 @@ public static function forEncodedValue( return children([]); } + // Skip xsi:type declaration for anonymous complexTypes : they don't have an accessible name. + $meta = $context->type->getMeta(); + if ($meta->isLocal()->unwrapOr(false)) { + return children([]); + } + [$xsiType, $includeXsiTargetNamespace] = match(true) { $encoder instanceof Feature\XsiTypeCalculator => [ $encoder->resolveXsiTypeForValue($context, $value), diff --git a/tests/PhpCompatibility/Schema036Test.php b/tests/PhpCompatibility/Schema036Test.php index 95e55df..5acd0e9 100644 --- a/tests/PhpCompatibility/Schema036Test.php +++ b/tests/PhpCompatibility/Schema036Test.php @@ -49,7 +49,7 @@ protected function expectXml(): string 123 - + 123