Итак, я передаю поле элементов массива вызову веб-службы, и запрос и ответ выглядят нормально, но я пытаюсь получить атрибут Value, чтобы указать тип, так что это мои поля:
$fields = array(
"Password"=>'password',
"entity"=>array(
"Name" =>"namehere",
"Id"=>'1234',
"Attributes"=>
array(
array(
"AttributeType"=>'SingleLineOfText',
"Key"=>'Key1',
"Value"=>'1',
),
array(
"AttributeType"=>'SingleLineOfText',
"Key"=>'Key2',
"Value"=>'2',
),
array(
"AttributeType"=>'DateAndTime',
"Key"=>'Key3',
"Value"=>'2016-09-16T00:00:00'
)
)
)
);
Итак, мой запрос:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-
ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://tempuri.org/"><SOAP-ENV:Body><ns1:Create>
<ns1:Password>password</ns1:Password><ns1:entity>
<ns1:Name>namehere</ns1:Name><ns1:Id>1234</ns1:Id><ns1:Attributes><ns1:Attribute>
<ns1:AttributeType>SingleLineOfText</ns1:AttributeType>
<ns1:Key>Key1</ns1:Key><ns1:Value>1</ns1:Value>
</ns1:Attribute><ns1:Attribute>
<ns1:AttributeType>SingleLineOfText</ns1:AttributeType>
<ns1:Key>Key2</ns1:Key><ns1:Value>2</ns1:Value>
</ns1:Attribute><ns1:Attribute>
<ns1:AttributeType>DateAndTime</ns1:AttributeType>
<ns1:Key>Key3</ns1:Key><ns1:Value>2016-09-16T00:00:00</ns1:Value></ns1:Attribute></ns1:Attributes></ns1:entity>
</ns1:Create></SOAP-ENV:Body></SOAP-ENV:Envelope>
Таким образом, вы можете видеть 1 </ ns1: Value>, но мне нужно, чтобы он был похож на возможность определить, на что похож тип 1 или 2016-09-16T00: 00: 00 если это поле даты, я попытался выполнить цикл и назначить его, но, похоже, это не так работа, вот цикл, который я пробовал
foreach($fields['entity']['Attributes'] as $attribute){
echo $attribute['Value'] = new SoapVar($attribute, XSD_STRING, "string", "http://www.w3.org/2001/XMLSchema");
}