@shevchenko__k
Помогаю новорожденным web программистам

Как отправить запрос wsdl через php?

Здравствуйте, помогите пожалуйста или подскажите мне , правильно ли я все делаю ?
У меня есть файлик.
Вот его содержимое
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://tempuri.org/" xmlns:ns2="http://www.w3.org/2005/08/addressing" xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:rgs="Rgs.Ufo">
  <env:Header><ns2:MessageID>urn:uuid:df18b300-909e-4f50-b7c7-50247b4b1c0c</ns2:MessageID>
<ns2:ReplyTo>
  <ns2:Address>http://www.w3.org/2005/08/addressing/anonymous</ns2:Address>
</ns2:ReplyTo>
<ns2:To s:mustUnderstand="1" xmlns:s="s">https://ufot.rgs.ru/Osago2Service.svc?singlewsdl</ns2:To>
<o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:s="s">
  <o:UsernameToken u:Id="uuid-728f6038-1949-4f93-b5ea-447271427c01-1" xmlns:u="u">
  <o:Username>xxx</o:Username>
  <o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">xxx</o:Password>
  </o:UsernameToken>
</o:Security><ns2:Action>http://tempuri.org/IOsagoService/Calculate</ns2:Action></env:Header>
  <env:Body>
  <rgs:Calculate>
<rgs:calcRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="Rgs.Ufo">
  <AddServiceStations i:nil="true"/>
  <Auto>
    <AllowWeight i:nil="true"/>
    <ChassisNumber i:nil="true"/>
    <ClassifierVehicleModelCode>036001522</ClassifierVehicleModelCode>
    <Document i:nil="true"/>
    <Documents>
      <Document>
        <IssueDate>2018-08-10T00:00:00</IssueDate>
        <Number>070625</Number>
        <Series>12АБ</Series>
        <TypeCode>ПТС</TypeCode>
      </Document>
      <Document>
        <IssueDate>2018-01-01T00:00:00</IssueDate>
        <Number>012124</Number>
        <Series>12БВ</Series>
        <TypeCode>СТС</TypeCode>
      </Document>
    </Documents>
    <Drivers>
      <Driver>
        <BirthDate>1993-03-14T00:00:00</BirthDate>
        <CountryCode i:nil="true"/>
        <DriverAddedDate i:nil="true" xmlns:d5p1="http://schemas.datacontract.org/2004/07/System"/>
        <DriverId>0</DriverId>
        <DrivingStartExperienceDate>2014-01-01T00:00:00</DrivingStartExperienceDate>
        <IsDriverAdded i:nil="true"/>
        <IsDriverRemoved i:nil="true"/>
        <License>
          <Number>123456</Number>
          <Series>1231</Series>
          <TypeCode>017</TypeCode>
        </License>
        <Name>
          <FirstName>Николай</FirstName>
          <LastName>Иванов</LastName>
          <SecondName>Сергеевич</SecondName>
        </Name>
        <PrevLicense i:nil="true"/>
        <PrevName i:nil="true"/>
      </Driver>
    </Drivers>
    <FrameNumber i:nil="true"/>
    <HasTrailer>false</HasTrailer>
    <KbmClassForPreCalc i:nil="true"/>
    <LicensePlate i:nil="true"/>
    <ManufactureYear>2017</ManufactureYear>
    <Power>123</Power>
    <PtsBrand i:nil="true"/>
    <PtsModel i:nil="true"/>
    <PurposeUseCode>1</PurposeUseCode>
    <SeatCount i:nil="true"/>
    <Vin i:nil="true"/>
  </Auto>
  <AutoDealerId i:nil="true"/>
  <BankCode i:nil="true"/>
  <BranchCode/>
  <CalculationDate xmlns:d2p1="http://schemas.datacontract.org/2004/07/System">
    <d2p1:DateTime>2018-09-10T14:26:39.8450295Z</d2p1:DateTime>
    <d2p1:OffsetMinutes>180</d2p1:OffsetMinutes>
  </CalculationDate>
  <CalculationId i:nil="true"/>
  <ClientAccept i:nil="true"/>
  <CorellationId i:nil="true"/>
  <EndDate xmlns:d2p1="http://schemas.datacontract.org/2004/07/System">
    <d2p1:DateTime>2019-09-09T20:59:59.999Z</d2p1:DateTime>
    <d2p1:OffsetMinutes>180</d2p1:OffsetMinutes>
  </EndDate>
  <Insurant>
    <Address i:nil="true"/>
    <BirthDate i:nil="true"/>
    <Contacts>
      <Email>Nikolai@mail.com</Email>
      <HomePhone i:nil="true"/>
      <MobilePhone i:nil="true"/>
      <WorkPhone i:nil="true"/>
    </Contacts>
    <Document i:nil="true"/>
    <Inn i:nil="true"/>
    <IsResident>true</IsResident>
    <KK i:nil="true"/>
    <KPP i:nil="true"/>
    <Name>
      <FirstName>Николай</FirstName>
      <LastName>Иванов</LastName>
      <SecondName>Олегович</SecondName>
    </Name>
    <OGRN i:nil="true"/>
    <OrganizationName i:nil="true"/>
    <PrevDocument i:nil="true"/>
    <PrevName i:nil="true"/>
    <SubjectTypeId>1</SubjectTypeId>
  </Insurant>
  <InsurantCompanyId>03000000</InsurantCompanyId>
  <IsAnyone>false</IsAnyone>
  <IsExistsKasko i:nil="true"/>
  <IsGrossViolationsOfInsurance>false</IsGrossViolationsOfInsurance>
  <IsPolicyPrintedFromEKIS i:nil="true"/>
  <IsPreCalculation>true</IsPreCalculation>
  <IsRsaChecked i:nil="true"/>
  <IsUpdate>false</IsUpdate>
  <LeasingCompanyId i:nil="true"/>
  <Logging>
    <QuotationId>0</QuotationId>
    <SessionId>5f820e7a-2db8-454c-b728-a016bb823ba4</SessionId>
    <UserProfileId>11930</UserProfileId>
  </Logging>
  <NeedKbmRequest>true</NeedKbmRequest>
  <OtherPartnerId i:nil="true"/>
  <Owner>
    <Address i:nil="true"/>
    <BirthDate i:nil="true"/>
    <Contacts i:nil="true"/>
    <Document i:nil="true"/>
    <Inn i:nil="true"/>
    <IsResident>true</IsResident>
    <KK i:nil="true"/>
    <KPP i:nil="true"/>
    <Name i:nil="true"/>
    <OGRN i:nil="true"/>
    <OrganizationName i:nil="true"/>
    <PrevDocument i:nil="true"/>
    <PrevName i:nil="true"/>
    <SubjectTypeId>1</SubjectTypeId>
  </Owner>
  <OwnerLicense i:nil="true"/>
  <Periods>
    <PeriodOfUse>
      <EndDate xmlns:d4p1="http://schemas.datacontract.org/2004/07/System">
        <d4p1:DateTime>2019-09-09T20:59:59Z</d4p1:DateTime>
        <d4p1:OffsetMinutes>180</d4p1:OffsetMinutes>
      </EndDate>
      <Id>1</Id>
      <IsUsagePeriodAdded i:nil="true"/>
      <IsUsagePeriodRemoved i:nil="true"/>
      <StartDate xmlns:d4p1="http://schemas.datacontract.org/2004/07/System">
        <d4p1:DateTime>2018-09-10T21:00:00Z</d4p1:DateTime>
        <d4p1:OffsetMinutes>180</d4p1:OffsetMinutes>
      </StartDate>
    </PeriodOfUse>
  </Periods>
  <PolicyCheckSum i:nil="true"/>
  <PolicyRegion i:nil="true"/>
  <PrimaryUseKladr>20000001000153700</PrimaryUseKladr>
  <RegistrationPlace>Rf</RegistrationPlace>
  <SaleChannelType2008Id>901</SaleChannelType2008Id>
  <ServiceStations i:nil="true"/>
  <StartDate xmlns:d2p1="http://schemas.datacontract.org/2004/07/System">
    <d2p1:DateTime>2018-09-09T21:00:00Z</d2p1:DateTime>
    <d2p1:OffsetMinutes>180</d2p1:OffsetMinutes>
  </StartDate>
  <UpdateRequest i:nil="true"/>
</rgs:calcRequest>
</rgs:Calculate>
  </env:Body>
</env:Envelope>



В каком формате мне его держать xml или wsdl ?
И мне его надо отправить на сервер по адресу https://ufot.rgs.ru/Osago2Service.svc?singlewsdl
Как мне это грамотно сделать ?
Я с генерировал нужный xml в переменную и отправил вот так :
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 600);
$result = curl_exec($ch);

print_r($result);

Выдало ошибку 403. Я думаю из за того что у меня может логин и пароль не правильно и не проходит авторизацию.
Документацию про SoapClient читал так и не могу там понять ничего. там вызывается после создания экземпляра какой то метод ну а у меня нет этого метода. Мне же надо отправить запрос и получить ответ.
Подскажите пожалуйста.
  • Вопрос задан
  • 498 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы
YCLIENTS Москва
от 200 000 до 350 000 ₽
Ведисофт Екатеринбург
от 25 000 ₽
ИТЦ Аусферр Магнитогорск
от 100 000 до 160 000 ₽
24 апр. 2024, в 09:32
25000 руб./за проект
24 апр. 2024, в 09:27
13000 руб./за проект
24 апр. 2024, в 09:20
10000 руб./за проект