Почему не формируется soap запрос?

Добрый день! Мне нужно сформировать soap запрос:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="urn://x-artefacts-gnivc-ru/inplat/servin/OpenApiMessageConsumerService/types/1.0">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:GetMessageRequest>
         <ns:Message>
            <AuthRequest xsi:schemaLocation="urn://x-artefacts-gnivc-ru/ais3/kkt/AuthService/types/1.0 schema.xsd" xmlns="urn://x-artefacts-gnivc-ru/ais3/kkt/AuthService/types/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
               <AuthAppInfo>
                  <MasterToken>eyJhbGciOiJIUzI1NiIsInR5cCI6...</MasterToken>
               </AuthAppInfo>
            </AuthRequest>
         </ns:Message>
      </ns:GetMessageRequest>
   </soapenv:Body>
</soapenv:Envelope>

Я формирую запрос вот так:
$service_Url = 'https://openapi.nalog.ru:8090/open-api/AuthService/0.1?wsdl';
    $options = array(
        'soap_version' => SOAP_1_1,
        'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP,
        'encoding' => 'UTF-8',
        'trace' => 1,
        'exceptions' => true,
        'cache_wsdl' => WSDL_CACHE_NONE,
        'features' => SOAP_SINGLE_ELEMENT_ARRAYS
    );
    $SoapClient = new SoapClient($service_Url, $options);
    try{
        
        $xml_req = '
            <AuthRequest xmlns="urn://x-artefacts-gnivc-ru/ais3/kkt/AuthService/types/1.0" xsi:schemaLocation="urn://x-artefacts-gnivc-ru/ais3/kkt/AuthService/types/1.0 schema.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <AuthAppInfo>
                    <MasterToken>'.$modx->getOption('MASTER_TOKEN_ISSUED_BY_FNS').'</MasterToken>
                </AuthAppInfo>
            </AuthRequest>';
        $daraArray = array();
        $daraArray['Message'] = $xml_req;
        $result = $SoapClient->GetMessage($daraArray);
        print_r($result);
    }catch(Exception $e){
        print_r($e);
    }
   echo $SoapClient->__getLastRequest();

У меня выходит исключение:

SoapFault exception: [soap:Client] Unmarshalling Error: cvc-complex-type.2.4.b: The content of element 'ns1:Message' is not complete. One of '{WC[##other:"urn://x-artefacts-gnivc-ru/inplat/servin/OpenApiMessageConsumerService/types/1.0"]}' is expected.  in


Метод $SoapClient->__getLastRequest(); возвращает вот что:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn://x-artefacts-gnivc-ru/inplat/servin/OpenApiMessageConsumerService/types/1.0">
    <SOAP-ENV:Body>
        <ns1:GetMessageRequest>
            <ns1:Message/>
        </ns1:GetMessageRequest>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Почему у меня не заполняется тег: <ns1:Message/>
Заранее большое спасибо!
  • Вопрос задан
  • 442 просмотра
Пригласить эксперта
Ответы на вопрос 1
agoalofalife
@agoalofalife
Team Lead
Могу предложить вам готовую библиотеку
Все проблемы уже решены в ней
Ответ написан
Комментировать
Ваш ответ на вопрос

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

Войти через центр авторизации
Похожие вопросы