I have to consume a SOAP web services with PHP and I get the title error.
The (partial) structure of the wsdl is as follows
<xs:element name="Obligations" type="tns:ObligationsType"/>
<xs:complexType name="ObligationsType">
<xs:sequence>
<xs:element maxOccurs="99" name="Taxes" type="tns:TaxesType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TaxesType">
<xs:sequence>
<xs:element name="tax">
<xs:simpleType>
<xs:restriction base="xs:int">
<xs:maxInclusive value="9999"/>
<xs:minInclusive value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="amount">
<xs:simpleType>
<xs:restriction base="xs:double">
<xs:minInclusive value="0.01"/>
<xs:maxInclusive value="9999999999.99"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
The associative array that I send:
$params = array(
'token' => $TOKEN,
'sign' => $SIGN,
'paymentEntity' => 1001,
'form' => array(
'formNumber' => 6042,
'idPaymentType' => 951,
'Obligations' => array (
array(
'Taxes' => array(
'tax' => 6041,
'amount' => 602.0
)
)
)
)
);
With Classes
class Taxes{
var $tax;
var $amount;
}
class Obligations{
var $Taxes;
}
class form{
var $formNumber;
var $idPaymentType;
var $Obligations;
}
I tried to do it with classes and I get the same error. The problem is from the Obligations object. I tried nesting like this:
'Obligations' = > array ('Taxes' = > array ('tax' = > 1, 'amount' = > 1.0)) I get Unrecognized field Obligations
'Obligations' = > array ('tax' = > 1, 'amount' = > 1.0) I get object has not 'Taxes' property
'Obligations' = > array (array ('Taxes' = > array ('tax' = > 1, 'amount' = > 1.0))) I get object has no 'tax' property
'Obligations' = > array ('Taxes' = > array ('tax' = > 1)) I get object has not 'amount' property
'Obligations' = > array ('Taxes' = > array ('amount' = > 1)) I get object has not 'tax' property
I would appreciate any suggestions. Greetings