За последние 24 часа нас посетили 20557 программистов и 1131 робот. Сейчас ищут 660 программистов ...

Работа с SOAP

Тема в разделе "PHP для профи", создана пользователем Intrerio, 6 фев 2021.

  1. Intrerio

    Intrerio Активный пользователь

    С нами с:
    20 мар 2015
    Сообщения:
    176
    Симпатии:
    7
    Добрый вечер друзья. Года четыре,наверное, не работал с SOAP.Да и раньше как то с трудом все было в данном направлении. Вот сейчас постала задача от руководства. Есть некая фронт-офисная самописная система. Суть системы - внесение данных о договорах с последующей передачей данных в разные удаленные сервисы. Все было прекрасно до момента пока не началась работа с одним государственным сервисом. Обмен данными проходит через SOAP с данным сервисом.
    Вот есть пример который мне направили:
    Код (Text):
    1. POST https://test-gc-service.mtsbu.ua/Service.svc
    2. Connection: Keep-Alive Content-Length: 2133
    3. Content-Type: text/xml; charset=utf-8 Accept-Encoding: gzip, deflate
    4. Expect: 100-continue
    5. Host: test-gc-service.mtsbu.ua
    6. Max-Forwards: 10
    7. SOAPAction: "https://gc.mtsbu.ua/GreenCardService/IService/UploadGreenCard"
    8. X-Original-URL: /Service.svc
    9. X-Forwarded-For: 193.239.152.25:21743
    10. X-ARR-SSL: 4096|256|C=GB, S=Greater Manchester, L=Salford, O=COMODO CA Limited, CN=COMODO RSA Domain Validation Secure Server CA|OU=Domain Control Validated, OU=PositiveSSL Wildcard, CN=*.mtsbu.ua
    11. X-ARR-LOG-ID: 3ac3694d-9e1a-4929-baf7-f81542823968
    12.  
    13. <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis- 200401-wss-wssecurity-utility-1.0.xsd">
    14. <s:Header>
    15. <o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-
    16. 1.0.xsd">
    17. <u:Timestamp u:Id="_0">
    18. <u:Created>2018-09-25T09:29:20.511Z</u:Created>
    19. <u:Expires>2018-09-25T09:34:20.511Z</u:Expires>
    20. </u:Timestamp>
    21. <o:UsernameToken u:Id="uuid-98e89ed6-5eda-4bc5-be9a-336463a26dd4-1">
    22. <o:Username>test_mtibu13</o:Username>
    23. <o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile- 1.0#PasswordText">test_mtibu13</o:Password>
    24. </o:UsernameToken>
    25. </o:Security>
    26. <To s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">https://test-gc-
    27. service.mtsbu.ua/Service.svc</To> <Action s:mustUnderstand="1"
    28. xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">https://gc.mtsbu.ua/GreenCardService/IService/UploadGreen Card</Action>
    29.   </s:Header>
    30.   <s:Body>
    31. <UploadGreenCard xmlns="https://gc.mtsbu.ua/GreenCardService">
    32. <GreenCard xmlns:a="http://schemas.datacontract.org/2004/07/EntityHelper.DataContracts"
    33. xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
    34. <a:Errors i:nil="true" xmlns:b="http://schemas.datacontract.org/2004/07/EntityHelper.Structs" /> <a:ISLOADED i:nil="true" />
    35. <a:isDuplicate i:nil="true" />
    36. <a:SQLErrorinfo i:nil="true" />
    37. <a:number>11947198</a:number>
    38. <a:c_compl>DContractStatusEnum_1</a:c_compl>
    39. <a:c_term>DPeriodEnum_13</a:c_term>
    40. <a:begdate>2016-06-09T00:00:00</a:begdate>
    41. <a:numb_ins>2943800501</a:numb_ins>
    42. <a:sur_ins>Masalab Dmytro</a:sur_ins>
    43. <a:name_ins i:nil="true" />
    44. <a:pname_ins i:nil="true" />
    45. <a:adress>Ukraine Luhanska obl., Rubizhne, str. Krasnoarmiiska 23, 1</a:adress> <a:zakldat>2016-06-09T00:00:00</a:zakldat>
    46. <a:note i:nil="true" />
    47. <a:marka i:nil="true" /> <a:gosnomer>ВВ2868АХ</a:gosnomer> <a:vin>ХТА210990Х2534770</a:vin> <a:c_type>DVehicleTypeGreenCardEnum_1</a:c_type>
    48. <a:c_mark>608</a:c_mark>
    49. <a:d_cancel i:nil="true" />
    50. <a:c_region i:nil="true" />
    51. <a:c_district i:nil="true" /> <a:city>Рубежное</a:city>
    52. <a:green_retpayment i:nil="true" />
    53. <a:chng_num i:nil="true" /> <a:c_person>DPersonStatusEnum_1</a:c_person> <a:birth_date>1998-07-30T00:00:00</a:birth_date> <a:c_citizen>DCitizenStatusEnum_1</a:c_citizen> <a:is_loaded_with_delay>true</a:is_loaded_with_delay> <a:__RecordDate i:nil="true" />
    54.       </GreenCard>
    55.     </UploadGreenCard>
    56.   </s:Body>
    57. </s:Envelope>
    Как это привести в понятный для PHP вид ну и построить клиент для подключения и отправки запроса?
     
    #1 Intrerio, 6 фев 2021
    Последнее редактирование: 6 фев 2021