Answer the question
In order to leave comments, you need to log in
How to form XML to SOAP in PHP?
You need to write an XML request in SOAP of the following form:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://aisws.ingos.ru/services/b2b/sales/agents/1.0/">
<soapenv:Header/>
<soapenv:Body>
<ns:GetTariffRequest>
<NeedList>1</NeedList>
<SessionToken>FA7ADGQXElGe8AQKWN0A0AWP5/626NAA6AXv</SessionToken>
<TariffParameters>
<Agreement>
<General>
<Product>753518300</Product>
<DateBeg>2018-09-06T00:00:00</DateBeg>
<DateEnd>2019-09-05</DateEnd>
<CitySales>77000000000</CitySales>
<Individual>N</Individual>
</General>
<Insurer>
<SbjRef>1</SbjRef>
<MobilePhone>79616172222</MobilePhone>
<Email>[email protected]</Email>
</Insurer>
<Owner>
<SbjRef>1</SbjRef>
</Owner>
<SubjectList>
<Subject SbjKey="1">
<SbjType>Ф</SbjType>
<SbjResident>Y</SbjResident>
<FullName>Тестер Веб Сервисович</FullName>
<Gender>М</Gender>
<BirthDate>1987-01-01</BirthDate>
<CountryCode>643</CountryCode>
<IdentityDocument>
<DocType>30363316</DocType>
<Serial>45 45</Serial>
<Number>545545</Number>
<DocDate>2010-01-01</DocDate>
<DocIssuedBy>ОВД г. Москва</DocIssuedBy>
</IdentityDocument>
<Address>
<CountryCode>643</CountryCode>
<CityCode>77000000000</CityCode>
<StreetCode>770000000000391</StreetCode>
<StreetName>8 Марта ул</StreetName>
<House>155</House>
<Flat>155</Flat>
</Address>
</Subject>
</SubjectList>
</Agreement>
</TariffParameters>
</ns:GetTariffRequest>
</soapenv:Body>
</soapenv:Envelope>
<Subject SbjKey="1">
$connect = new stdClass();
$connect->NeedList='1';
$connect->SessionToken='4A3ADaUXNFIaQALOT55ACA3DOZ8KJTMASAUZ';
$connect->TariffParameters->Agreement->General->Product='753518300';
$connect->TariffParameters->Agreement->General->DateBeg='2018-09-06T00:00:00';
$connect->TariffParameters->Agreement->General->DateEnd='2019-09-05';
$connect->TariffParameters->Agreement->General->CitySales='77000000000';
$connect->TariffParameters->Agreement->General->Individual='N';
$connect->TariffParameters->Agreement->Insurer->SbjRef='1';
$connect->TariffParameters->Agreement->Insurer->MobilePhone='79616172222';
$connect->TariffParameters->Agreement->Insurer->Email='[email protected]';
$connect->TariffParameters->Agreement->Owner->SbjRef='1';
$connect->TariffParameters->Agreement->SubjectList->Subject->SbjType='Ф';
$connect->TariffParameters->Agreement->SubjectList->Subject->SbjResident='Y';
$connect->TariffParameters->Agreement->SubjectList->Subject->FullName='Тестер Веб Сервисович';
$connect->TariffParameters->Agreement->SubjectList->Subject->Gender='М';
$connect->TariffParameters->Agreement->SubjectList->Subject->BirthDate='1987-01-01';
$connect->TariffParameters->Agreement->SubjectList->Subject->CountryCode='643';
$connect->TariffParameters->Agreement->SubjectList->Subject->IdentityDocument->DocType='30363316';
$connect->TariffParameters->Agreement->SubjectList->Subject->IdentityDocument->Serial='45 45';
$connect->TariffParameters->Agreement->SubjectList->Subject->IdentityDocument->Number='545545';
$connect->TariffParameters->Agreement->SubjectList->Subject->IdentityDocument->DocDate>='2010-01-01';
$connect->TariffParameters->Agreement->SubjectList->Subject->IdentityDocument->DocIssuedBy='ОВД г. Москва';
$connect->TariffParameters->Agreement->SubjectList->Subject->Address->CountryCode='643';
$connect->TariffParameters->Agreement->SubjectList->Subject->Address->CityCode='77000000000<';
$connect->TariffParameters->Agreement->SubjectList->Subject->Address->StreetCode='770000000000391';
$connect->TariffParameters->Agreement->SubjectList->Subject->Address->StreetName='8 Марта ул';
$connect->TariffParameters->Agreement->SubjectList->Subject->Address->House='155';
$connect->TariffParameters->Agreement->SubjectList->Subject->Address->Flat>='155';
Answer the question
In order to leave comments, you need to log in
You will have to manually compose the XML. SoapClient has no built-in tools for working with attributes.
$xw = new XMLWriter();
$xw->openMemory();
$xw->startElementNS('ns1', 'GetTariffRequest', null);
$xw->startElement('NeedList');
$xw->text('1');
$xw->endElement();
$xw->startElement('Subject');
$xw->writeAttribute('SbjKey', '1');
$xw->endElement();
$xw->endElement();
$s = new SoapClient(...);
$s->GetTariff(new SoapVar($xw->outputMemory(), XSD_ANYXML));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question