2016-07-28 66 views
4

我最近從PHP5.4升級到PHP7。男孩是一個變化,但那不重要。PHP7 SoapClient問題

自升級以來,我遇到了SoapService問題。

這裏是我的SoapRequest看起來像在PHP5.4:

<?xml version="1.0" encoding="UTF-8"?> 
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="urn:usaepay" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:enc="http://www.w3.org/2003/05/soap-encoding"> 
<env:Body> 
    <ns1:searchTransactions env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"> 
    <Token xsi:type="ns1:ueSecurityToken"> 
     <ClientIP xsi:type="xsd:string">*redacted*</ClientIP> 
     <PinHash xsi:type="ns1:ueHash"> 
      <HashValue xsi:type="xsd:string">*redacted*</HashValue> 
      <Seed xsi:type="xsd:string">*redacted*</Seed> 
      <Type xsi:type="xsd:string">sha1</Type> 
     </PinHash> 
     <SourceKey xsi:type="xsd:string">*redacted*</SourceKey> 
    </Token> 
    <Search enc:itemType="ns1:SearchParam" enc:arraySize="3" xsi:type="ns1:SearchParamArray"> 
     <item xsi:type="ns1:SearchParam"> 
      <Field xsi:type="xsd:string">created</Field> 
      <Type xsi:type="xsd:string">gt</Type> 
      <Value xsi:type="xsd:string">2016-07-26</Value> 
     </item> 
     <item xsi:type="ns1:SearchParam"> 
      <Field xsi:type="xsd:string">created</Field> 
      <Type xsi:type="xsd:string">lt</Type> 
      <Value xsi:type="xsd:string">2016-07-27</Value> 
     </item> 
     <item xsi:type="ns1:SearchParam"> 
      <Field xsi:type="xsd:string">response</Field> 
      <Type xsi:type="xsd:string">eq</Type> 
      <Value xsi:type="xsd:string">A</Value> 
     </item> 
    </Search> 
    <MatchAll xsi:type="xsd:boolean">true</MatchAll> 
    <Start xsi:type="xsd:integer">0</Start> 
    <Limit xsi:type="xsd:integer">9999</Limit> 
    <Sort xsi:type="xsd:string">TransID</Sort> 
</ns1:searchTransactions> 
</env:Body> 
</env:Envelope> 

這裏是請求的樣子上運行PHP7完全相同的一段代碼:

<?xml version="1.0" encoding="UTF-8"?> 
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="urn:usaepay" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="http://xml.apache.org/xml-soap" xmlns:enc="http://www.w3.org/2003/05/soap-encoding"> 
<env:Body> 
    <ns1:searchTransactions env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"> 
    <Token xsi:type="ns1:ueSecurityToken"> 
     <ClientIP xsi:type="xsd:string">*redacted*</ClientIP> 
     <PinHash xsi:type="ns1:ueHash"> 
      <HashValue xsi:type="xsd:string">*redacted*</HashValue> 
      <Seed xsi:type="xsd:string">*redacted*</Seed> 
      <Type xsi:type="xsd:string">sha1</Type> 
     </PinHash> 
     <SourceKey xsi:type="xsd:string">*redacted*</SourceKey> 
    </Token> 
    <Search enc:itemType="ns2:Map" enc:arraySize="3" xsi:type="ns1:SearchParamArray"> 
     <item xsi:type="ns2:Map"> 
      <item> 
       <key xsi:type="xsd:string">Field</key> 
       <value xsi:type="xsd:string">created</value> 
      </item> 
      <item> 
       <key xsi:type="xsd:string">Type</key> 
       <value xsi:type="xsd:string">gt</value> 
      </item> 
      <item> 
       <key xsi:type="xsd:string">Value</key> 
       <value xsi:type="xsd:string">2016-07-26</value> 
      </item> 
     </item> 
     <item xsi:type="ns2:Map"> 
      <item> 
       <key xsi:type="xsd:string">Field</key> 
       <value xsi:type="xsd:string">created</value> 
      </item> 
      <item> 
       <key xsi:type="xsd:string">Type</key> 
       <value xsi:type="xsd:string">lt</value> 
      </item> 
      <item> 
       <key xsi:type="xsd:string">Value</key> 
       <value xsi:type="xsd:string">2016-07-26</value> 
      </item> 
     </item> 
     <item xsi:type="ns2:Map"> 
      <item> 
       <key xsi:type="xsd:string">Field</key> 
       <value xsi:type="xsd:string">response</value> 
      </item> 
      <item> 
       <key xsi:type="xsd:string">Type</key> 
       <value xsi:type="xsd:string">eq</value> 
      </item> 
      <item> 
       <key xsi:type="xsd:string">Value</key> 
       <value xsi:type="xsd:string">A</value> 
      </item> 
     </item> 
    </Search> 
    <MatchAll xsi:type="xsd:boolean">true</MatchAll> 
    <Start xsi:type="xsd:integer">0</Start> 
    <Limit xsi:type="xsd:integer">9999</Limit> 
    <Sort xsi:type="xsd:string">created</Sort> 
</ns1:searchTransactions> 
</env:Body> 
</env:Envelope> 

這裏是相關的PHP代碼:(注意$ sec)是已編輯的安全信息。

$param = array(
      array('Field' => 'created', 'Type' => 'gt', 'Value' => date('Y-m-d', strtotime('2016-07-26'))), 
      array('Field' => 'created', 'Type' => 'lt', 'Value' => date('Y-m-d', strtotime('2016-07-26'))), 
      array('Field' => 'response', 'Type' => 'eq', 'Value' => 'A') 
      ); 

$matchAll = true; 
$start = 0; 
$limit = 9999; 
$sort = 'TransID'; 

$this->advClient = new SoapClient($this->adv_wsdl, array('trace' => 1, 'exceptions' => 1, 'cache_wsdl' => WSDL_CACHE_BOTH, 'soap_version' => SOAP_1_2)); 
$result = $this->advClient->searchTransactions($sec, $searchParam, $matchAll, $start, $limit, $sort); 

我最終得到的是一個錯誤。我認爲這個問題是PHP7中包裝和添加額外的「item」標籤。但是,一些功能仍然沒有問題。有沒有人碰到過這個?

回答

2

有趣的是,我使用了wsdltophp.com併爲WSDL創建了一個類,並且一切正常。