Calls service on local server.

@param string $serviceName

@return mixed|null
770363
protected function callLocalService($serviceName)
    {
        if (!defined('TMP_PATH')) {
            define('TMP_PATH', $this->getTestConfig()->getTempDirectory());
        }

        $config = new ServiceConfig($this->getTestConfig()->getShopPath(), $this->getTestConfig()->getTempDirectory());
        $config->setShopEdition($this->getTestConfig()->getShopEdition());

        $serviceCaller = new ServiceFactory($config);
        $request = new Request($this->getParameters());
        $service = $serviceCaller->createService($serviceName);

        return $service->init($request);
    }
1298276
public function call($functionname, $params) {
        if ($this->token) {
            $this->serverurl->param('wstoken', $this->token);
        }
        $this->serverurl->param('wsdl', 1);

        $opts = array(
            'http' => array(
                'user_agent' => 'Moodle SOAP Client'
            )
        );
        $context = stream_context_create($opts);
        $this->options['stream_context'] = $context;
        $this->options['cache_wsdl'] = WSDL_CACHE_NONE;

        $client = new SoapClient($this->serverurl->out(false), $this->options);

        return $client->__soapCall($functionname, $params);
    }
160038
protected function call() {
    if (isset($this->service) && isset($this->call)) {
      return $this->service->process($this->call);
    }
  }
962104
function getService(serviceName) {
		var serviceData = services[serviceName];

		if (serviceData) {
			if (!serviceData.instance) {
				serviceData.instance = serviceData.creator(application);
			}

			return serviceData.instance;
		}

		return null;
	}
1085170
protected function lazyLoad($eventName)
    {
        parent::lazyLoad($eventName);

        if (isset($this->listenerIds[$eventName])) {
            foreach ($this->listenerIds[$eventName] as $args) {
                list($serviceId, $method, $priority, $queueName) = $args;
                if ($queueName != null) {
                    $listener = $this->container->get($serviceId);
                    $key = $serviceId.'.'.$method;
                    $this->listeners[$eventName][$key] = array($listener, $queueName);
                }
            }
        }
    }
984203
public function __exec($serviceName)
	{
		try {
			$server = new SoapServer($this->getWsdlFileName($serviceName));
			$server->setObject(new SoapProxy($serviceName,$this->wsdlStyle,$this->wsdlUse));
			$server->handle();
		} catch (Exception $exception) {
			Log::add('Soap服务接口执行错误:'.$exception->getMessage().' 文件:'.$exception->getFile().' 行数:'.$exception->getLine());
		}
		Log::add(microtime(true) - YURUN_START);
	}
178088
public function disconnect( $serviceName = null ) {
        $service = $this->getService( $serviceName );
        $service->disconnect();

        return ! $service->isConnected();
    }
35444
public function getServiceList(string $serviceName, ...$params)
    {
        $httpClient = new Client();
        $url        = $this->getDiscoveryUrl($serviceName);
        $result     = $httpClient->get($url)->getResult();
        $services   = json_decode($result, true);

        // 数据格式化
        $nodes = [];
        foreach ($services as $service) {
            if (!isset($service['Service'])) {
                App::warning("consul[Service] 服务健康节点集合，数据格式不不正确，Data=" . $result);
                continue;
            }
            $serviceInfo = $service['Service'];
            if (!isset($serviceInfo['Address'], $serviceInfo['Port'])) {
                App::warning("consul[Address] Or consul[Port] 服务健康节点集合，数据格式不不正确，Data=" . $result);
                continue;
            }
            $address = $serviceInfo['Address'];
            $port    = $serviceInfo['Port'];

            $uri     = implode(":", [$address, $port]);
            $nodes[] = $uri;
        }

        return $nodes;
    }
1306903
public function unpersistService($serviceName)
    {
        if (isset($this->persistentServices[$serviceName])) {
            unset($this->persistentServices[$serviceName]);
        }
        if (isset($this->permanentServices[$serviceName])) {
            unset($this->permanentServices[$serviceName]);
        }
        if ($this->client && isset($this->client->persistentServices[$serviceName])) {
            unset($this->client->persistentServices[$serviceName]);
        }
    }
454801
public function callService($serviceName, $action, array $parameters = array(), array $files = array())
    {
        $httpClient = $this->getHTTPClient();

        $url = $this->getServiceUrl($serviceName, $action);
        $request = new Request('POST', $url, $this->getRequestHeaders($url, $parameters), $this->getRequestBody($parameters, $files));

        try {
            $response = $httpClient->send($request);
        } catch (GuzzleRequestException $exception) {
            $response = $exception->getResponse();
        }

        $this->validateAPIResponseCode($request, $response);

        return $response;
    }
42075
public function loadStatus($serviceName, $attributeName) {
        if (isset($this->data[$serviceName][$attributeName])) {
            return $this->data[$serviceName][$attributeName];
        }
        return "";
    }
285649
public function get($serviceName) {
        $container = $this->serviceData[$serviceName] ?? NULL;
        if($container) {
            return $container->getInstance();
        }

        if(in_array($serviceName, $this->getSelfReferenceNames()))
            return $this;

        $e = new UnknownServiceException("Service $serviceName is not registered", E_USER_ERROR);
        $e->setServiceName($serviceName);
        throw $e;
    }
293870
public function request($classname)
    {
        $instance = $this->instance($classname);
        return ($instance != null ? $instance->request() : null);
    }
727137
public function setService($serviceName)
    {
        if (!array_key_exists($serviceName, $this->servicesList)) {
            $serviceName = $this->defaultServiceName;
        }

        $this->service = new $this->servicesList[$serviceName];

        return $this;
    }
104995
public static function forgeService($serviceName) {
		if(empty($serviceName)) {
			return null;
		}
		if(is_object($serviceName)) {
			return $serviceName;
		} elseif(is_string($serviceName)) {
			return ArrayHelper::getValue(\App::$domain, $serviceName);
		}
		return null;
	}
70051
public static function get($name, $call = true)
    {
        if (!isset(self::$services[$name])) {
            throw new \RuntimeException("The service [$name] don't register.");
        }

        $service = self::$services[$name];

        if (\is_object($service) && $service instanceof \Closure && $call) {
            if (!isset(self::$instances[$name])) {
                self::$instances[$name] = $service();
            }

            return self::$instances[$name];
        }

        return $service;
    }
1072124
public function isRegistered( $serviceName ) {

		if ( is_string( $serviceName ) && isset( $this->aliases[$serviceName] ) ) {
			$serviceName = $this->aliases[$serviceName];
		}

		return isset( $this->registry[$serviceName] );
	}