Answer the question
In order to leave comments, you need to log in
How to make the correct PHP array for SOAP in 1C from xml tags?
Good afternoon!
I can’t catch up how to make some variables for SOAP
there is such a request:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ru="ru.umc" xmlns:core="http://v8.1c.ru/8.1/data/core">
<soap:Header/>
<soap:Body>
<ru:BookAnAppointmentWithParams>
<ru:EmployeeID>b7995b97-e511-11e8-87af-485b39d0ac73</ru:EmployeeID>
<ru:PatientSurname>Иванов</ru:PatientSurname>
<ru:PatientName>Иван</ru:PatientName>
<ru:PatientFatherName>Петрович</ru:PatientFatherName>
<ru:Date>2019-04-19T00:00:00</ru:Date>
<ru:TimeBegin>0001-01-01T10:05:00</ru:TimeBegin>
<ru:Comment>test</ru:Comment>
<ru:Phone>891112345678</ru:Phone>
<ru:Email>[email protected]</ru:Email>
<ru:Address>Черноморская 5</ru:Address>
<ru:Clinic>546546-cc73-11e8-9c03-54645645645</ru:Clinic>
<ru:GUID></ru:GUID>
<ru:Params>
<!--Zero or more repetitions:-->
<core:Property name="Birthday">
<core:Value>1999-01-01T00:00:00</core:Value>
</core:Property>
<core:Property name="Duration">
<core:Value>0001-01-01T00:30:00</core:Value>
</core:Property>
</ru:Params>
<ru:Service>b29148a5-e518-11e8-87af-485b39d0ac73</ru:Service>
</ru:BookAnAppointmentWithParams>
</soap:Body>
</soap:Envelope>
$client = new SoapClient(WSDL, array('login' => WSDL_LOGIN, 'password' => WSDL_PWD));
$propertyArr = array();
$propertyArr[]=['name'=>'Birthday', 'value'=>'1999-01-01T00:00:00'];
$propertyArr[]=['name'=>'Duration', 'value'=>'0001-01-01T00:30:00'];
$query= array('EmployeeID'=>'b7995b97-e511-11e8-87af-485b39d0ac73', 'PatientSurname'=>'Иванов','PatientName'=>'Иван','PatientFatherName'=>'Петрович', 'Date'=>'2019-04-19T00:00:00', 'TimeBegin'=>'0001-01-01T00:00:00', 'Comment'=>'test', 'Phone'=>'891112345678', 'Email'=>'[email protected]', 'Address'=>'Черноморская 5', 'Clinic'=> '546546-cc73-11e8-9c03-54645645645',
'GUID'=>'', 'Params'=> $propertyArr, 'Service'=>'b29148a5-e518-11e8-87af-485b39d0ac73');
$result = $client->BookAnAppointmentWithParams($query);
<ru:Params>
<!--Zero or more repetitions:-->
<core:Property name="Birthday">
<core:Value>1999-01-01T00:00:00</core:Value>
</core:Property>
<core:Property name="Duration">
<core:Value>0001-01-01T00:30:00</core:Value>
</core:Property>
</ru:Params>
<core:Property name="Birthday">
<core:Value>1999-01-01T00:00:00</core:Value>
?
Answer the question
In order to leave comments, you need to log in
$propertyArr = array();
$propertyArr[] = new SoapVar(
(object)['name' => 'Birthday', 'value' => '1999-01-01T00:00:00'],
SOAP_ENC_OBJECT,
'Property',
'core');
$propertyArr[] = new SoapVar(
(object)['name' => 'Duration', 'value' => '0001-01-01T00:30:00'],
SOAP_ENC_OBJECT,
'Property',
'core');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question