registerNamespace ( 'Thrift', $path ); $nsLoader->registerNamespace ( 'Osp', $path ); $nsLoader->registerNamespace ( 'vipapis', $path ); $nsLoader->register (); } public static function getService(){ if (! AccountServiceClient::$isRegis){ AccountServiceClient::regis (); AccountServiceClient::$isRegis = true; } $ctx = \Osp\Context\InvocationContextFactory::getInstance (); $ip = AccountServiceClient::$DEFAULT_PROXY_IP; $port = AccountServiceClient::$DEFAULT_PROXY_PORT; try{ $envCfg = getenv ( "VIP_OSP_PROXY" ); $ipport = explode ( ":", $envCfg ); if (strlen ( $envCfg ) > 0 && count ( $ipport ) == 2){ $ip = $ipport [0]; $port = $ipport [1]; } } catch(\Exception $e){ $ip = AccountServiceClient::$DEFAULT_PROXY_IP; $port = AccountServiceClient::$DEFAULT_PROXY_PORT; } if ($ctx->getCalleeIP () == null){ $ctx->setCalleeIP ( $ip ); } if ($ctx->getCalleePort () == null){ $ctx->setCalleePort ( $port ); } //$ctx->setProtocol ( \Osp\Protocol\OspProtocol::$Binary ); return new \vipapis\account\AccountServiceHelper(); } } ?>