I have to send this XML with SoapClient:
<xml>
<field>
<subfield1>value</subfield1>
<subfield2>value</subfield2>
</field>
<field>
<subfield1>value</subfield1>
<subfield2>value</subfield2>
</field>
</xml>
So I created this PHP array:
$params = [
'field' => [
['subfield1' => 'value', 'subfield2' => 'value']
['subfield1' => 'value', 'subfield2' => 'value']
]
]
// ...
$client = new SoapClient($wsdl, $config);
$client->method($params);
But I don't understand why I get the following error:
SOAP-ERROR: Encoding: object has no 'subfield1' property
For information, the WSDL contains that following:
<xs:sequence>
<xs:element name="field" type="tns:field" minOccurs="0" />
</xs:sequence>
<xs:complexType name="field">
<xs:sequence>
<xs:element name="subfield1" type="xs:string" />
<xs:element name="subfield2" type="xs:string" />
</xs:sequence>
</xs:complexType>
I already checked the issue SoapClient: how to pass multiple elements with same name? but it didn't help me.