2011-05-09 21 views
0

返回結束時的WSDL文件位於附加http://www.rasd.ro/BSEFinancialsWS/financials.asmx?op=GetCompanyBalance奇怪的零在雙值通過SOAP網絡服務的

對於IdentityType嘗試符號

對於身份嘗試BVB

對於REPORTTYPE嘗試Q1

對於年嘗試

基本上,您`ll得到的是:

> <CompanyBalance> 
> <Company> 
> <CompanyName>SC BURSA DE VALORI BUCURESTI SA</CompanyName> 
> <FiscalCode>17777754</FiscalCode> 
> </Company> 
> <LastYear>2011</LastYear> 
> <ReportType>Q1</ReportType> 
> <NetCrtLiab>64931998</NetCrtLiab> 
> <CrtAssets>67220118</CrtAssets> 
> <FixedAssets>25299375</FixedAssets> 
> <PaidUpCap>76741980</PaidUpCap> 
> <ShahEqy>90231373</ShahEqy> 
> <OpExp>2975724</OpExp> 
> <ExtrExp>0</ExtrExp> 
> <FinExp>1411570</FinExp> 
> <TotExp>4387294</TotExp> 
> <NetTurn>5977651</NetTurn> 
> <Debt1>0</Debt1> 
> <Debt2>2086920</Debt2> 
> <TotLiab>2086920</TotLiab> 
> <BackPay>0</BackPay> 
> <NoPaidTax>0</NoPaidTax> 
> <Empl>57</Empl> <BackLiab>0</BackLiab> 
> <BackPaym>0</BackPaym> 
> <Gross>2624119</Gross> 
> <OpRes>3002199</OpRes> 
> <ExtrRes>0</ExtrRes> 
> <FinRes>-378080</FinRes> 
> <NetRes>2196413</NetRes> 
> <CurrRes>2624119</CurrRes> 
> <ResPerShare xsi:nil="true"/> 
> <TotAssets>90231373</TotAssets> 
> <TotReceiv>3368756</TotReceiv> 
> <RevInAdv>584055</RevInAdv> 
> <OpIncome>5977923</OpIncome> 
> <ExIncome>0</ExIncome> 
> <FinInc>1033490</FinInc> 
> <TotRev>**7011413**</TotRev> 
> </CompanyBalance> 

通知的TotRev價值?那麼,它應該是s exactly how it。 現在,我實現SoapClient的我有:

...

static $WSConf=array(
     'financials'=>array('host'=>'rasd.ro','port'=>80,'wsdlURL'=>'http://www.rasd.ro/BSEFinancialsWS/financials.asmx?WSDL'), 
     'companies'=>array('host'=>'rasd.ro','port'=>80,'wsdlURL'=>'http://www.rasd.ro/BSEFinancialsWS/companiesandsecurities.asmx?WSDL'),); 

...

private static function S($name) { 

    $name=strtolower($name); 

    if(!is_object(self::$soapClients[$name])) { 
     self::$soapClients[$name] = new SoapClient(self::$WSConf[$name]['wsdlURL']);  
    } 
    if(is_object(self::$soapClients[$name])) { 

     self::Delay(); 

     return self::$soapClients[$name]; 
    } 
    error_log('site.ro '.__FILE__.' error'."\n\n".__FILE__.': '.__CLASS___.'::'.__METHOD__."\n\n msc_WebServBVB2 ".date('Y-M-d H:i:s')."\nCannot init webservice {$name}", 3, WSBVBExtLOG); 
} 

...

public static function RaportareFinanciara($simbol,$timestampOrAn,$trimestru=false){ 
     self::timerReset(); 
     if(empty($trimestru)) { 
      $trimestru=utilsDT::Quarter($timestampOrAn); 
      $an=date('Y',$timestampOrAn); 
     }else{ 
      $an=$timestampOrAn; 
     } 



     $IdentityType='Symbol'; 
     $Identity=$simbol; 
     $Year=$an; 
     $ReportType=strtr($trimestru,array('1'=>'Q1','2'=>'Semestrial','3'=>'Q3','4'=>'Annual')); 

     $balanceType=self::GetBalanceType($IdentityType,$Identity,$ReportType,$Year); 
     $type=$balanceType['BalanceType']; 
     if(!empty($type)) { 

      switch($type) { 

       case 'Company': 
        $balance=self::GetCompanyBalance($IdentityType,$Identity,$ReportType,$Year); 
        break; 

       case 'Bank': 
        $balance=self::GetBankBalance($IdentityType,$Identity,$ReportType,$Year); 
        break; 

       case 'Assurance': 
        $balance=self::GetInsuranceBalance($IdentityType,$Identity,$ReportType,$Year); 
        break; 

       case 'Fund': 
        $balance=self::GetInvestmentFundsBalance($IdentityType,$Identity,$ReportType,$Year); 
        break; 

       default: 
        return false; 
      } 


      if(!empty($balance)) { 

       if(self::$debug) { 
        self::timerAddAction("Mapping balance fields to compatibility names for ".strtolower($type)); 
       } 

       if(isset(self::$BVBROAPI_FldCorespCustom[strtolower($type)])) { 
        $FldCoresp=array_merge(self::$BVBROAPI_FldCoresp,self::$BVBROAPI_FldCorespCustom[strtolower($type)]); 
       }else{ 
        $FldCoresp=self::$BVBROAPI_FldCoresp; 
       } 

       if(self::$debug) { 
        print_r($FldCoresp); 
       } 

       $result=array(); 
       foreach($FldCoresp as $compat_name=>$wsname) { 
        if(isset($balance[$wsname])) { 
         $result[$compat_name]=$balance[$wsname];       
        } 
       } 

       $result['BallanceType']=$type; 
       if(!empty($result)) { 
        if(self::$debug) { 
         self::timerPrintInfo(); 
        } 
        return $result; 
       } 
      } 
      if(self::$debug) { 
       self::timerAddAction("Balance empty"); 
      } 

     } 
     if(self::$debug) { 
      self::timerPrintInfo(); 
     } 
     return false; 

    } 

...

public st atic函數GetCompanyBalance($ IdentityType,$ Identity,$ ReportType,$ Year){0} {0} {0} self :: timerReset();

if(self::$debug) { 
     self::timerAddAction("Called GetCompanyBalance ($IdentityType,$Identity,$ReportType,$Year) Method");  
    } 

    $cacheid='webservbvbext_balance'.$IdentityType.$Identity.$ReportType.$Year; 

    if(self::$debug) { 
     self::timerAddAction("Checking cache"); 

    } 
    if(self::CM()->cacheIsExpired($cacheid)) { 


     if(self::$debug) { 
      self::timerAddAction("Calling webservice Method"); 
     } 

     try{ 

      $rawresult=self::S('Financials')->GetCompanyBalance(array('IdentityType'=>$IdentityType,'Identity'=>$Identity,'ReportType'=>$ReportType,'Year'=>$Year)); 
     } catch (Exception $e) { 
      if(self::$debug) { 
       self::timerAddAction('Caught exception: ', $e->getMessage()); 
      } 
      return false; 
     } 



     if(self::$debug) { 
      echo '<pre>'; 
      print_r($rawresult); 
      echo '</pre>'; 
     } 

     if(self::$debug) { 
      self::timerAddAction("Mapping array fields"); 
     } 


     if(!empty($rawresult) && sizeof($rawresult)>=1) { 
      $fields=array(); 
      foreach($rawresult->GetCompanyBalanceResult as $key=>$Field) { 

       $Field=(is_object($Field) ? (array) $Field : $Field); 
       $fields[$key]=$Field; 

      } 

      if($fields['LastYear']!=$Year || $fields['ReportType']!=$ReportType) { 
       return false; 
      } 


      if(self::$debug) { 
       self::timerAddAction("Caching results"); 

      } 

      self::CM()->cacheThis($cacheid,'',self::$cacheTime['Ballance'],$fields,true); 


      if(self::$debug) { 
       self::timerAddAction("Finished caching. Return data"); 

      } 
      if(self::$debug) { 
       self::timerPrintInfo(); 
      } 
      if(!empty($fields)) { 
       return $fields; 
      } 
     } 
     return false; 

    }else{ 
     $out=self::CM()->getCached($cacheid); 
     if(is_array($out) && !empty($out)) { 
      if(self::$debug) { 

       self::timerAddAction("Cached Request Details: ".date('Y.m.d H:i:s',self::CM()->cacheTimeStmp($cacheid))); 
       self::timerPrintInfo(); 
      } 

      return $out; 
     } 
     return false; 


    } 

...

所以運行是這樣的:

$result=msc_WebServBVBExt::GetCompanyBalance('Symbol','BVB','Q1',2011); 



echo "<pre>"; 
print_r($result); 
echo "</pre>"; 

返回:

Array 

( [公司] =>陣列 ( [公司名稱] => SC BURSA DE VALORI BUCURESTI SA [FiscalCode] => 17777754 )

[LastYear] => 2011 
[ReportType] => Q1 
[NetCrtLiab] => 6493199800 
[CrtAssets] => 6722011800 
[FixedAssets] => 2529937500 
[PaidUpCap] => 7674198000 
[ShahEqy] => 9023137300 
[OpExp] => 297572400 
[ExtrExp] => 0 
[FinExp] => 141157000 
[TotExp] => 438729400 
[NetTurn] => 597765100 
[Debt1] => 0 
[Debt2] => 208692000 
[TotLiab] => 208692000 
[BackPay] => 0 
[NoPaidTax] => 0 
[Empl] => 57 
[BackLiab] => 0 
[BackPaym] => 0 
[Gross] => 262411900 
[OpRes] => 300219900 
[ExtrRes] => 0 
[FinRes] => -37808000 
[NetRes] => 219641300 
[CurrRes] => 262411900 
[ResPerShare] => 
[TotAssets] => 9023137300 
[TotReceiv] => 336875600 
[RevInAdv] => 58405500 
[OpIncome] => 597792300 
[ExIncome] => 0 
[FinInc] => 103349000 
**[TotRev] => 701141300** 

} 

當你從最後一個值注意到,它有2個0處的值的末尾。 任何想法爲什麼?

回答

1

也許這個價值應該是美元和美分。許多金融系統被設計用於以整數格式存儲貨幣,其表示以美分或密爾爲單位的金額與美元相反。

+0

這可能是問題,但問題是,我的腳本永遠不會存儲任何東西,因爲這個值是錯誤的。只是調用Web服務得到我的2個零值,所以爲什麼我會存儲一個錯誤的值。從他們的操作點運行Web服務,http://www.rasd.ro/BSEFinancialsWS/financials.asmx?op=GetCompanyBalance,具有上述細節,返回正確的值,即7011413 – Gabriel 2011-05-09 12:42:16