V
V
Vanes Ri_Lax2020-12-30 10:13:33
PHP
Vanes Ri_Lax, 2020-12-30 10:13:33

Why is the soap request not generated?

Good afternoon! I need to form a soap request:

<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>

I form the request like this:
$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();

I'm getting an exception:

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


Method $SoapClient->__getLastRequest(); returns this:
<?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>

Why is my tag not filling in: <ns1:Message/>
Thank you very much in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya Chubarov, 2021-11-02
@agoalofalife

I can offer you a ready-made library
All problems have already been solved in it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question