Q
Q
qxeacwzd2018-03-12 16:22:22
PHP
qxeacwzd, 2018-03-12 16:22:22

Php SoapClient via wsdl - why are parameters not being passed?

https://www.onvif.org/ver10/search.wsdl

$this->client = new SoapClient($this->wsdl, array(
      'trace' => true, 
      'exceptions' => true, 
#			'cache_wsdl' => WSDL_CACHE_NONE,
      'ssl' => array(
        'verify_peer' => false,
        'allow_self_signed' => true
      ),
      'soap_version' => SOAP_1_2,
    ));
    $this->client->__setLocation($service);
    $params = array(
      'Scope' => array(
        'IncludedSources' => array('Token' => ''),
        'Extension'  => array(
          'CameraUuid' => $CameraUuid,
          'StartTime' => $StartTime,
          'StopTime' => $StopTime,
        ),
      ),
      'KeepAliveTime' => $KeepAlive
    );
    return $this->client->FindRecordings($params);

however in wireshark i see body like this
<env:Body>
      <ns2:FindRecordings>
         <ns2:Scope>
            <ns1:IncludedSources>
               <ns1:Token />
            </ns1:IncludedSources>
            <ns1:Extension />
         </ns2:Scope>
         <ns2:KeepAliveTime>PT10S</ns2:KeepAliveTime>
      </ns2:FindRecordings>
   </env:Body>

in a similar case with this wsdl
https://www.onvif.org/ver10/media/wsdl/media.wsdl
, such a line passes parameters to the method without any problems
return $this->client->GetStreamUri(array(
      'StreamSetup' => array(
        'Stream' => $stream_type,
        'Transport'  => array(
          'Protocol' => $protocol,
        ),
      ),
      'ProfileToken' => $profile
    ));

<env:Body>
      <ns2:GetStreamUri>
         <ns2:StreamSetup>
            <ns1:Stream>RTP-Unicast</ns1:Stream>
            <ns1:Transport>
               <ns1:Protocol>TCP</ns1:Protocol>
            </ns1:Transport>
         </ns2:StreamSetup>
         <ns2:ProfileToken>1892abb3d4c0e916b79a2fe02f338069</ns2:ProfileToken>
      </ns2:GetStreamUri>
   </env:Body>

I just can’t understand why in the first case the parameters are not transferred normally, but in the second they are transferred?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Leonid, 2018-03-30
@primipilus

Try this part

array(
          'CameraUuid' => $CameraUuid,
          'StartTime' => $StartTime,
          'StopTime' => $StopTime,
        ),

wrap in SoapVar
In general, read about SoapVar. This class will help you explicitly specify the data type
php.net/manual/ru/class.soapvar.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question