php soap throw指定的强制转换是无效的

时间:2015-06-19 08:03:42

标签: php soap

我需要创建的请求xml格式是:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns1="http://tempuri.org/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<ns1:GetPagingData>
  <ns1:guid>connection session identifier goes here</ns1:guid>
  <ns1:dataRequest>
    <ns1:ObjectType>HotelServices</ns1:ObjectType>
    <ns1:PageSize>10</ns1:PageSize>
    <ns1:PageIndex>1</ns1:PageIndex>
  <ns1:Filters>
    <ns1:DataFilterPair>
      <ns1:Key>Accommodation_DateChekIn</ns1:Key>
      <ns1:Values>
        <ns1:anyType>2015-07-15</ns1:anyType>
      </ns1:Values>
      </ns1:DataFilterPair>
        <ns1:DataFilterPair>
          <ns1:Key>Accommodation_DateChekOut</ns1:Key>
          <ns1:Values>
            <ns1:anyType>2015-07-20</ns1:anyType>
          </ns1:Values>
        </ns1:DataFilterPair>
        <ns1:DataFilterPair>
          <ns1:Key>Accommodation_MrKey</ns1:Key>
          <ns1:Values>
            <ns1:anyType>13</ns1:anyType>
          </ns1:Values>
        </ns1:DataFilterPair>
        <ns1:DataFilterPair>
            <ns1:Key>Accommodation_Rate</ns1:Key>
            <ns1:Values>
              <ns1:anyType>EU</ns1:anyType>
            </ns1:Values>
        </ns1:DataFilterPair>
        <ns1:DataFilterPair>
          <ns1:Key>Accommodation_Pax</ns1:Key>
          <ns1:Values>
            <ns1:anyType>2</ns1:anyType>
          </ns1:Values>
        </ns1:DataFilterPair>
        <ns1:DataFilterPair>
          <ns1:Key>Accommodation_PartnerKey</ns1:Key>
          <ns1:Values>
            <ns1:anyType>3722</ns1:anyType>
          </ns1:Values>
        </ns1:DataFilterPair>
        <ns1:DataFilterPair>
          <ns1:Key>Accommodation_PartnerGroupKey</ns1:Key>
          <ns1:Values>
            <ns1:anyType>4391</ns1:anyType>
          </ns1:Values>
        </ns1:DataFilterPair>
        <ns1:DataFilterPair>
          <ns1:Key>Accommodation_QuoteType</ns1:Key>
          <ns1:Values>
            <ns1:anyType>1</ns1:anyType>
          </ns1:Values>
        </ns1:DataFilterPair>
        <ns1:DataFilterPair>
          <ns1:Key>Accommodation_HotelKey</ns1:Key>
          <ns1:Values>
            <ns1:anyType>2265</ns1:anyType>
          </ns1:Values>
        </ns1:DataFilterPair>
        <ns1:DataFilterPair>
          <ns1:Key>Accommodation_Tariffs</ns1:Key>
          <ns1:Values>
            <ns1:anyType>0</ns1:anyType>
          </ns1:Values>
        </ns1:DataFilterPair>
        <ns1:DataFilterPair>
          <ns1:Key>Accommodation_AccommodationKey</ns1:Key>
          <ns1:Values>
            <ns1:anyType>2233</ns1:anyType>
          </ns1:Values>
        </ns1:DataFilterPair>
        <ns1:DataFilterPair>
          <ns1:Key>Accommodation_PansionKey</ns1:Key>
          <ns1:Values>
            <ns1:anyType>41</ns1:anyType>
          </ns1:Values>
        </ns1:DataFilterPair>
      </ns1:Filters>
      <ns1:ColumnNames>
        <ns1:string>HotelName</ns1:string>
        <ns1:string>HotelKey</ns1:string>
        <ns1:string>RtCode</ns1:string>
        <ns1:string>RtKey</ns1:string>
        <ns1:string>RcName</ns1:string>
        <ns1:string>RcKey</ns1:string>
        <ns1:string>RdName</ns1:string>
        <ns1:string>RdKey</ns1:string>
        <ns1:string>AcName</ns1:string>
        <ns1:string>AcKey</ns1:string>
        <ns1:string>PnCode</ns1:string>
        <ns1:string>PnKey</ns1:string>
        <ns1:string>Cost</ns1:string>
        <ns1:string>DetailBrutto</ns1:string>
        <ns1:string>QuoteType</ns1:string>
        <ns1:string>CountryKey</ns1:string>
        <ns1:string>CityKey</ns1:string>
        <ns1:string>HotelWebSite</ns1:string>
        <ns1:string>TariffId</ns1:string>
        <ns1:string>TariffName</ns1:string>
        <ns1:string>TariffDescription</ns1:string>
      </ns1:ColumnNames>
  </ns1:dataRequest>
</ns1:GetPagingData>

当我检查我使用$ client-&gt; __ getLastRequest()进行的请求时,我得到的格式如上所示,但我也收到错误:

  

&#34;服务器无法处理请求。 ---&GT;指定演员表无效。&#34;

我的职能:

public function makeCall($methodName, $methodParams) {
    try {
        $res = $this->client->__soapCall($methodName,  array('parameters'=>$methodParams));
        return $res;
    } catch(SoapFault $sf) {
        $this->printPre("An error occured while calling function ".$methodName."!");
        $this->printPre($sf);
        $this->printPre($this->client->__getLastRequest(), 4);
    }
    return null;
}

public function printPre($string, $type=3) {
    print "<pre>";
    switch($type) {
        case 1: print $string; break;
        case 2: print_r($string); break;
        case 3: var_dump($string); break;
        case 4: var_dump(htmlspecialchars($string)); break;
    }
    print "</pre>";
}

public function getPagingData() {
    $params = array(
        'guid'=>$this->getConnectionString(),
        'dataRequest'=>array(
            'ObjectType'=>'HotelServices',
            'PageSize'=>10,
            'PageIndex'=>1,
            'Filters'=>array(
                array('Key'=>'Accommodation_DateChekIn', 'Values'=>array('2015-07-15')),
                array('Key'=>'Accommodation_DateChekOut', 'Values'=>array('2015-07-20')),
                array('Key'=>'Accommodation_MrKey', 'Values'=>array(13)),
                array('Key'=>'Accommodation_Rate', 'Values'=>array('EU')),
                array('Key'=>'Accommodation_Pax', 'Values'=>array(2)),
                array('Key'=>'Accommodation_PartnerKey', 'Values'=>array(3722)),
                array('Key'=>'Accommodation_PartnerGroupKey', 'Values'=>array(4391)),
                array('Key'=>'Accommodation_QuoteType', 'Values'=>array(1)),
                array('Key'=>'Accommodation_HotelKey', 'Values'=>array(2265)),
                array('Key'=>'Accommodation_AccommodationKey', 'Values'=>array(2233)),
                array('Key'=>'Accommodation_PansionKey', 'Values'=>array(41))
            ),
            'ColumnNames'=>array('HotelName', 'HotelKey', 'RtCode', 'RtKey', 'RcName', 'RcKey', 'RdName', 'RdKey', 'AcName', 'AcKey', 'PnCode', 'PnKey', 'Cost', 'DetailBrutto', 'QuoteType', 'CountryKey', 'CityKey', 'HotelWebSite', 'TariffId', 'TariffName', 'TariffDescription')
        )
    );
    $allPagingData = $this->makeCall('GetPagingData', $params);
    $this->printPre($allPagingData);
}

错误是否与需要发送的anyType字段有关?我需要转换为某种其他格式吗?尝试strtotime约会,但没有运气。任何帮助表示赞赏!

谢谢!

0 个答案:

没有答案