Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/263.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP soapCall-不传递所有参数_Php_Soap - Fatal编程技术网

PHP soapCall-不传递所有参数

PHP soapCall-不传递所有参数,php,soap,Php,Soap,以下是我脚本的开头: <?php $soapUrl = 'http://webservicetocall.com/Interface/ChannelConnect.asmx?WSDL'; $client = new SoapClient($soapUrl); $headerBody = array( 'From' => array( 'Credential' => array( 'userName' => 'MYU

以下是我脚本的开头:

  <?php
  $soapUrl = 'http://webservicetocall.com/Interface/ChannelConnect.asmx?WSDL';

  $client = new SoapClient($soapUrl);

  $headerBody = array(
    'From' => array(
      'Credential' => array(
        'userName' =>  'MYUSERNAME',
        'password' => 'MYPASSWORD',
      )
    ),
  );

  $params = array(
    'OTA_HotelAvailRQ' => array(
      'BestOnly' => 'false',
      'SummaryOnly' => 'false',
      'HotelStayOnly' => 'true',
      'MaxResponses' => 0,
      'ExactMatchOnly' => 'true',
      'POS' => array(
        'Source' => array(
          'Requestor' => array(
            'ID_Context' => 'Synxis',
            'ID' => '10',
            'CompanyName' => array(
              'Code' => 'AAAA',
            ),
          ),
        ),
      ),
      'AvailableRequestSegements' => array(
        'AvailableRequestSegment' => array(
          'AvailReqType' => 'Room',
          'StayDateRange' => array(
            'Start' => '05/10/2015',
            'End' => '05/17/2015',
          ),
          'RoomStayCandidate' => array(
            'Quantity' => '1',
            'GuestCounts' => array(
              'GuestCount' => array(
                'AgeQualifyingCode' => '10',
                'Count' => '1',
              ),
            ),
          ),
          'HotelSearchCriteria' => array(
            'Criterion' => array(
              'HotelRef' => array(
                'HotelCode' => '12345',
              ),
            ),
          ),
        ),
      ),
    ),
  );

  $ns = 'http://htng.org/1.1/Header/';

  $client = new SoapClient($soapUrl, array(
      'trace' => 1,
      'cache_wsdl' => WSDL_CACHE_NONE,
      'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
    )
  );

  $header = new SOAPHeader($ns, 'HTNGHeader', $headerBody);

  $client->__setSoapHeaders($header);

  $hotel_info = $client->__soapCall('CheckAvailability', $params);

  $last_call = $client->__getLastRequest();

我的用户名
我的密码

结果表明,我没有正确输入所有密钥是错误的。结果表明,我没有正确输入所有密钥是错误的。
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.opentravel.org/OTA/2003/05" xmlns:ns2="http://htng.org/1.1/Header/">
    <SOAP-ENV:Header>
        <ns2:HTNGHeader>
            <ns2:From>
                <ns2:Credential>
                    <ns2:userName>MYUSERNAME</ns2:userName>
                    <ns2:password>MYPASSWORD</ns2:password>
                </ns2:Credential>
            </ns2:From>
        </ns2:HTNGHeader>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <ns1:OTA_HotelAvailRQ BestOnly="true" ExactMatchOnly="true" HotelStayOnly="true" MaxResponses="0" SummaryOnly="true">
            <ns1:POS>
                <ns1:Source/>
            </ns1:POS>
        </ns1:OTA_HotelAvailRQ>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>