Skip to content

Failed decoding / mapping by parameter xsi:type #596

@Harkonn

Description

@Harkonn

Bug Report

Q A
BC Break yes/no
Version 4.5.0

Summary

The mapping for xzufi:struktur should map to LeistungsstrukturObjektMitVerrichtung but it throws an exception:

Phpro\SoapClient\Exception\SoapException: Failed decoding type Soap\Encoding\Xml\Node\Element as {http://xoev.de/schemata/xzufi/2_2_0:leistungen.antwort.leistung.040104}. Failed at path "parameters.antwort.ergebnis.leistung.struktur". in Phpro\SoapClient\Exception\SoapException::fromThrowable() (line 19 of projectpath/vendor/phpro/soap-client/src/Phpro/SoapClient/Exception/SoapException.php).

Snipped SOAP responce code for struktur (full code is below):

<xzufi:struktur xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xzufi:LeistungsstrukturObjektMitVerrichtung">

Current behavior

The generated type Leistung has a property $struktur with a type of Leistungsstruktur. The generated type for Leistungsstruktur is an abstract class. The generated type for LeistungsstrukturObjektMitVerrichtung extends the abstract class Leistungsstruktur and should be mapped by the attribute in the SOAP-response xsi:type="xzufi:LeistungsstrukturObjektMitVerrichtung".

abstract class Leistungsstruktur
{
}
class LeistungsstrukturObjekt extends Leistungsstruktur
{
    /**
     * Zuordnung der Leistungsgruppierung, z.B. "Baurecht".
     *
     * @var null | namespace\Type\LeistungsgruppierungAuswahl
     */
    private ?namespace\Type\LeistungsgruppierungAuswahl $leistungsgruppierung = null;
    // more code
class LeistungsstrukturObjektMitVerrichtung extends LeistungsstrukturObjekt
{
     /**
     * ID des zugeordneten Leistungsobjekts (Basis).
     *
     * @var namespace\Type\Identifikator
     */
    private namespace\Type\Identifikator $leistungsobjektID;

    // more code
}
class Leistung
{
    /**
     * Angabe der Struktur der Leistung gemäß LeiKa. Eine Leistung ist entweder Leistungsobjekt (LO), Leistungsobjekt mit Verrichtung (LOV) oder Leistungsobjekt mit Verrichtung und Detail (LOVD).
     *
     *
     * Folgt die Leistung nicht dieser Struktur bzw. ist eine reine Auskunftsleistung, wird dieses Attribut nicht gesetzt.
     *
     * @var null | namespace\Type\Leistungsstruktur
     */
    private ?namespace\Type\Leistungsstruktur $struktur = null;

    // more code

The generated classmap contains these types:

    // stripped classmap code
	new ClassMap('http://xoev.de/schemata/xzufi/2_2_0', 'Leistungsstruktur', Type\Leistungsstruktur::class),
	new ClassMap('http://xoev.de/schemata/xzufi/2_2_0', 'LeistungsstrukturObjekt', Type\LeistungsstrukturObjekt::class),
	new ClassMap('http://xoev.de/schemata/xzufi/2_2_0', 'LeistungsstrukturObjektMitVerrichtung', Type\LeistungsstrukturObjektMitVerrichtung::class),

How to reproduce

  1. Configure soap-client.php with setTypeReplacementStrategy from Generated types that use enums have wrong parameters #594.
  2. Run ./vendor/bin/soap-client generate:types --config config/soap-client.php for https://xzufi-v2-2-0-nw-schul.infodienste.de/?wsdl (warning: it will generate 1400 files...)
  3. Run ./vendor/bin/soap-client generate:classmap --config config/soap-client.php for https://xzufi-v2-2-0-nw-schul.infodienste.de/?wsdl
  4. Use this snipped Response to start the mapping process:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <xzufi:leistungen.antwort.leistung.040104 xmlns:ns8="http://www.isotc211.org/2005/gts" xmlns:ns7="http://www.isotc211.org/2005/gmd" xmlns:ns6="http://www.isotc211.org/2005/gco" xmlns:ns5="http://www.w3.org/1999/xlink" xmlns:ns4="http://www.opengis.net/gml/3.2" xmlns:xzufi="http://xoev.de/schemata/xzufi/2_2_0" produktbezeichnung="XZufi" produkthersteller="Test" produktversion="3.18.005" xzufiVersion="2.2.0">
      <xzufi:nachrichtenkopf>
        <xzufi:nachrichtUUID>f7376363-4f97-4774-a73d-806cd9268654</xzufi:nachrichtUUID>
        <xzufi:erstelltDatumZeit>2025-11-18T09:29:01.771+01:00</xzufi:erstelltDatumZeit>
        <xzufi:sender>Test sender</xzufi:sender>
      </xzufi:nachrichtenkopf>
      <xzufi:antwort>
        <xzufi:antwortnummer>REQ-TEST-0001</xzufi:antwortnummer>
        <xzufi:antwortrueckgabecode listURI="urn:xoev-de:fim:codeliste:xzufi.nachrichtantwortcode" listVersionID="1.1">
          <code>000</code>
        </xzufi:antwortrueckgabecode>
        <xzufi:anfrage>
          <xzufi:anfragenummer>REQ-TEST-0001</xzufi:anfragenummer>
          <xzufi:zusatzinformation>Manueller Test</xzufi:zusatzinformation>
          <xzufi:suchprofil>
            <xzufi:id schemeAgencyID="GK_LEIKA" schemeID="LEIKA_LEISTUNG_SCHLUESSEL">99110021012000</xzufi:id>
            <xzufi:elementfilterSprache>de</xzufi:elementfilterSprache>
            <xzufi:kennzeichenNurBasisinformation>false</xzufi:kennzeichenNurBasisinformation>
          </xzufi:suchprofil>
        </xzufi:anfrage>
        <xzufi:ergebnis>
          <xzufi:leistung>
            <xzufi:id schemeAgencyID="Test_schemeAgencyID" schemeAgencyName="Test_schemeAgencyName" schemeID="Test_schemeID" schemeName="Test_schemeName">121404447</xzufi:id>
            <xzufi:struktur xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xzufi:LeistungsstrukturObjektMitVerrichtung">
              <xzufi:leistungsgruppierung>
                <xzufi:leistungsgruppierungLeiKa listURI="urn:de:fim:leika:leistungsgruppierung" listVersionID="20231229">
                  <code>110</code>
                </xzufi:leistungsgruppierungLeiKa>
              </xzufi:leistungsgruppierung>
              <xzufi:leistungsobjektID>121404446</xzufi:leistungsobjektID>
              <xzufi:verrichtung>
                <xzufi:verrichtungLeiKa listURI="urn:de:fim:leika:verrichtung" listVersionID="20230523">
                  <code>012</code>
                  <name>Ausstellung</name>
                </xzufi:verrichtungLeiKa>
              </xzufi:verrichtung>
            </xzufi:struktur>
            <xzufi:referenzLeiKa listURI="urn:de:fim:leika:leistung" listVersionID="20240721">
              <code>99110021012000</code>
              <name>EU-Heimtierausweis Ausstellung</name>
            </xzufi:referenzLeiKa>
            <xzufi:modulText>
              <xzufi:inhalt languageCode="de-DE">EU-Heimtierausweis Ausstellung</xzufi:inhalt>
              <xzufi:leikaTextmodul listURI="urn:de:xzufi:codeliste:leistungstextmodulleika" listVersionID="20240216">
                <code>02</code>
              </xzufi:leikaTextmodul>
            </xzufi:modulText>
          </xzufi:leistung>
        </xzufi:ergebnis>
      </xzufi:antwort>
    </xzufi:leistungen.antwort.leistung.040104>
  </soap:Body>
</soap:Envelope>

Expected behavior

The xzufi:struktur element should be mapped to LeistungsstrukturObjektMitVerrichtung because of the parameter xsi:type="xzufi:LeistungsstrukturObjektMitVerrichtung".

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions