当前位置: 首页>>代码示例>>PHP>>正文


PHP SoapClient::Connect方法代码示例

本文整理汇总了PHP中SoapClient::Connect方法的典型用法代码示例。如果您正苦于以下问题:PHP SoapClient::Connect方法的具体用法?PHP SoapClient::Connect怎么用?PHP SoapClient::Connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SoapClient的用法示例。


在下文中一共展示了SoapClient::Connect方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Client constructor
  * @param integer   $agreement
  * @param integer   $userId
  * @param string    $password
  */
 public function __construct($agreement, $userId, $password)
 {
     $this->agreement = $agreement;
     $this->userId = $userId;
     $this->password = $password;
     $this->client = new SoapClient($this->apiUrl, $this->debug);
     $this->client->Connect(array('agreementNumber' => $this->agreement, 'userName' => $this->userId, 'password' => $this->password));
 }
开发者ID:lizard2010,项目名称:Economic-PHP-SDK,代码行数:14,代码来源:Client.php

示例2: get_soap_connection

/**
 *
 */
function get_soap_connection()
{
    static $client;
    if (!isset($client)) {
        $settings = parse_ini_file(realpath(dirname(__FILE__) . '/economics.ini'));
        try {
            $client = new SoapClient($settings['wsdl_endpoint'], array("trace" => 1, "exceptions" => 1));
            $client->Connect(array('agreementNumber' => $settings['agreement_number'], 'userName' => $settings['user_name'], 'password' => $settings['password']));
        } catch (SoapFault $fault) {
            trigger_error(sprintf("Soap fault %s - %s", $fault->faultcode, $fault->faultstring), E_USER_ERROR);
        }
    }
    return $client;
}
开发者ID:kristiannissen,项目名称:PHPEconomics,代码行数:17,代码来源:economics.v1.php

示例3: checkParameter

try {
    // Helper function to check query parameters.
    function checkParameter($param)
    {
        if (!isset($_REQUEST[$param])) {
            echo "Missing <code>" . $param . "</code> parameter in query string.";
            exit(0);
        }
    }
    checkParameter("agreementNumber");
    checkParameter("username");
    checkParameter("password");
    $me = $_SERVER['PHP_SELF'];
    $wsdlUrl = 'https://api.e-conomic.com/secure/api1/EconomicWebservice.asmx?WSDL';
    $client = new SoapClient($wsdlUrl, array("trace" => 1, "exceptions" => 1));
    $client->Connect(array('agreementNumber' => $_REQUEST['agreementNumber'], 'userName' => $_REQUEST['username'], 'password' => $_REQUEST['password']));
    if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['action'] == 'create_debtor') {
        try {
            $debtorGroupHandles = $client->debtorGroup_GetAll()->DebtorGroup_GetAllResult->DebtorGroupHandle;
            $firstDebtorGroup = $debtorGroupHandles[0];
            $newDebtorHandle = $client->Debtor_Create(array('number' => $_POST['debtor_number'], 'debtorGroupHandle' => $firstDebtorGroup, 'name' => $_POST['debtor_name'], 'vatZone' => 'EU'))->Debtor_CreateResult;
            $client->Debtor_SetAddress(array('debtorHandle' => $newDebtorHandle, 'value' => $_POST['debtor_address']));
            print "<p>A new debtor has be created.</p>";
        } catch (Exception $exception) {
            print "<p><b>Could not create debtor.</b></p>";
            print "<p><i>" . $exception->getMessage() . "</i></p>";
        }
    }
    // Fetch list of all debtors.
    $debtorHandles = $client->Debtor_GetAll()->Debtor_GetAllResult->DebtorHandle;
    $debtorDataObjects = $client->Debtor_GetDataArray(array('entityHandles' => $debtorHandles))->Debtor_GetDataArrayResult->DebtorData;
开发者ID:ocace,项目名称:eco-api-ex,代码行数:31,代码来源:list_debtors.php

示例4: _connect

 /**
  * connect to the e-conomic server
  *
  * @return the client object
  */
 private function _connect()
 {
     try {
         $client = new SoapClient('https://www.e-conomic.com/secure/api1/EconomicWebservice.asmx?WSDL', array("trace" => 1, "exceptions" => 1));
         $client->Connect(array('agreementNumber' => $this->_agreementNumber, 'userName' => $this->_username, 'password' => $this->_password));
     } catch (Exception $e) {
         echo __('Could not connect to E-Conomic server');
     }
     return $client;
 }
开发者ID:raylouis,项目名称:kvwebme,代码行数:15,代码来源:plugin.php

示例5: loaddataAction

 public function loaddataAction()
 {
     //try {
     $wsdlUrl = 'https://api.e-conomic.com/secure/api1/EconomicWebservice.asmx?WSDL';
     $client = new \SoapClient($wsdlUrl, array("trace" => 1, "exceptions" => 1));
     $translator = $this->getServiceLocator()->get('translator');
     /* Get current local user */
     $user = $this->zfcUserAuthentication()->getIdentity();
     $entityManager = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
     /* Get E-conomic credentials for current user */
     $eUser = $entityManager->getRepository('MyEconomic\\Entity\\EconomicUser')->findOneBy(array('user' => $user));
     /* Connect to E-conomic SOAP API server */
     if (empty($eUser)) {
         return $this->redirect()->toRoute('myeconomic', array('action' => 'adduser'));
     }
     /* Connect to E-conomic SOAP API server */
     $client->Connect(array('agreementNumber' => $eUser->getAgreementNumber(), 'userName' => $eUser->getUsername(), 'password' => $eUser->getPassword()));
     /* Get accounting years */
     $accYears = $client->AccountingPeriod_GetAll()->AccountingPeriod_GetAllResult->AccountingPeriodHandle;
     $accPeriodData = $client->AccountingPeriod_GetDataArray(array('entityHandles' => $accYears))->AccountingPeriod_GetDataArrayResult;
     /* Get accounting periods */
     $accountPeriods = array();
     $tmpPeriod = array();
     $tmp = array();
     $counter = count($accPeriodData->AccountingPeriodData);
     foreach ($accPeriodData->AccountingPeriodData as $period) {
         if (!in_array($period->AccountingYearHandle->Year, $tmp)) {
             array_push($tmp, $period->AccountingYearHandle->Year);
             if ($tmpPeriod) {
                 array_push($accountPeriods, $tmpPeriod);
             }
             $tmpPeriod = array('Year' => $period->AccountingYearHandle->Year, 'SubPeriods' => array());
         }
         $tmpSubPeriod['FromDate'] = $period->FromDate;
         $tmpSubPeriod['ToDate'] = $period->ToDate;
         array_push($tmpPeriod['SubPeriods'], $tmpSubPeriod);
         $counter--;
         if (!$counter) {
             array_push($accountPeriods, $tmpPeriod);
         }
     }
     /* Get turnovers */
     $keyFigureCodeHundlers = $client->KeyFigureCode_FindByNumber(array('number' => '1'))->KeyFigureCode_FindByNumberResult;
     $accs = $client->KeyFigureCode_GetAccounts(array('keyFigureCodeHandle' => $keyFigureCodeHundlers))->KeyFigureCode_GetAccountsResult;
     if ($accs->AccountHandle) {
         /* Get turnovers array for every month */
         foreach ($accountPeriods as $year) {
             $tmpPeriod = array();
             foreach ($year['SubPeriods'] as $period) {
                 $tmp = abs(array_sum($client->Account_GetEntryTotalsByDate(array('accounts' => $accs->AccountHandle, 'first' => $period['FromDate'], 'last' => $period['ToDate']))->Account_GetEntryTotalsByDateResult->decimal));
                 array_push($tmpPeriod, $tmp);
             }
             $turnover[$year['Year']] = $tmpPeriod;
         }
         /* Save Turnovers in local database */
         foreach ($turnover as $key => $value) {
             /* check if record already exist */
             $tmp = $entityManager->getRepository('MyEconomic\\Entity\\Turnover')->findOneBy(array('user' => $user, 'year' => $key));
             $turnoverRecord = $tmp ? $tmp : new Turnover();
             /* fill fields with data */
             $turnoverRecord->setUser($user);
             $turnoverRecord->setYear($key);
             $turnoverRecord->setTurnover(json_encode($value));
             /* save */
             $entityManager->persist($turnoverRecord);
             $entityManager->flush();
         }
     }
     /* Get Variable Costs */
     $keyFigureCodeHundlers = $client->KeyFigureCode_FindByNumber(array('number' => '2'))->KeyFigureCode_FindByNumberResult;
     $accs = $client->KeyFigureCode_GetAccounts(array('keyFigureCodeHandle' => $keyFigureCodeHundlers))->KeyFigureCode_GetAccountsResult;
     if ($accs->AccountHandle) {
         /* Get variable costs array for every month */
         foreach ($accountPeriods as $year) {
             $tmpPeriod = array();
             foreach ($year['SubPeriods'] as $period) {
                 $tmp = abs(array_sum($client->Account_GetEntryTotalsByDate(array('accounts' => $accs->AccountHandle, 'first' => $period['FromDate'], 'last' => $period['ToDate']))->Account_GetEntryTotalsByDateResult->decimal));
                 array_push($tmpPeriod, $tmp);
             }
             $variableCosts[$year['Year']] = $tmpPeriod;
         }
         /* Save Variable Costs in local database */
         foreach ($variableCosts as $key => $value) {
             /* check if record already exist */
             $tmp = $entityManager->getRepository('MyEconomic\\Entity\\VariableCosts')->findOneBy(array('user' => $user, 'year' => $key));
             $variableCostsRecord = $tmp ? $tmp : new VariableCosts();
             /* fill fields with data */
             $variableCostsRecord->setUser($user);
             $variableCostsRecord->setYear($key);
             $variableCostsRecord->setVariableCosts(json_encode($value));
             /* save */
             $entityManager->persist($variableCostsRecord);
             $entityManager->flush();
         }
     }
     /* Get Company Tax */
     $keyFigureCodeHundlers = $client->KeyFigureCode_FindByNumber(array('number' => '9'))->KeyFigureCode_FindByNumberResult;
     $accs = $client->KeyFigureCode_GetAccounts(array('keyFigureCodeHandle' => $keyFigureCodeHundlers))->KeyFigureCode_GetAccountsResult;
     if ($accs->AccountHandle) {
         /* Get Company Tax array for every month */
//.........这里部分代码省略.........
开发者ID:shitikovkirill,项目名称:zend.co,代码行数:101,代码来源:IndexController.php


注:本文中的SoapClient::Connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。