I am trying to generate a SOAP XML request that looks something like this:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dto="dto" xmlns:com="">
<soapenv:Header>
<dto:AuthenticationDTO>
<dto:LOGIN_ID>login</dto:LOGIN_ID>
<dto:LOGIN_PASSWORD>login</dto:LOGIN_PASSWORD>
</dto:AuthenticationDTO>
</soapenv:Header>
<soapenv:Body>
<com:createAccount>
<com:AccountFields>
<!--Zero or more repetitions:-->
<dto:FieldDTO>
<!--Optional:-->
<dto:children/>
<!--Optional:-->
<dto:fieldType>GENERAL</dto:fieldType>
<!--Optional:-->
<dto:index>0</dto:index>
<!--Optional:-->
<dto:label>BusinessName</dto:label>
<!--Optional:-->
<dto:name>BizInfo-BusinessName</dto:name>
<!--Optional:-->
<dto:value>the business name</dto:value>
</dto:FieldDTO>
<!--Zero or more repetitions:-->
<dto:FieldDTO>
<!--Optional:-->
<dto:children/>
<!--Optional:-->
<dto:fieldType>GENERAL</dto:fieldType>
<!--Optional:-->
<dto:index>0</dto:index>
<!--Optional:-->
<dto:label>BusinessCountry</dto:label>
<!--Optional:-->
<dto:name>BizInfo-Country</dto:name>
<!--Optional:-->
<dto:value>US</dto:value>
</dto:FieldDTO>
</com:AccountFields>
<com:ApplicationNumber></com:ApplicationNumber>
<com:CreditTerms></com:CreditTerms>
<com:GenerateAccountIdIndicator>true</com:GenerateAccountIdIndicator>
</com:createAccount>
I get a response using this code:
$matchCompany->FieldList->FieldDTO->fieldType = 'GENERAL';
$matchCompany->FieldList->FieldDTO->label = 'Business Name';
$matchCompany->FieldList->FieldDTO->name = 'BizInfo-BusinessName';
$matchCompany->FieldList->FieldDTO->index = '0';
try
{
$result = $soapClient->getAccountInfo($matchCompany);
print "<pre>";
print_r($result);
print "</pre>";
echo "REQUEST:\n" . htmlentities($soapClient->__getLastRequest()) . "\n";
}
catch(SoapFault $fault)
{
echo $fault->faultcode . "-" . $fault->faultstring;
echo "REQUEST:\n" . htmlentities($soapClient->__getLastRequest()) . "\n";
}
but if I try to array the fielddto item like this:
//$matchCompany->FieldList->FieldDTO[]['fieldType'] = 'GENERAL';
//$matchCompany->FieldList->FieldDTO[]['label'] = 'Business Name';
//$matchCompany->FieldList->FieldDTO[]['name'] = 'BizInfo-BusinessName';
//$matchCompany->FieldList->FieldDTO[]['index'] = '0';
It wraps each item in it's own FieldDTO tag instead of placing all four items in a single FieldDTO tag.
What am I missing? It seems like it should work, but it's not quite right.