public function execute(
        $actionName,
        array $requestParameters = array(),
        $content = "",
        array $urlBuildParameters = array(),
        array $headersValue = array()
    ) {
        // Getting configured action request object
        $actionRequest = $this->getActionRequestByName($actionName);
        if (!$actionRequest instanceof AbstractActionRequest) {
            throw new BadConfiguredActionException($this->getNotValidRequestExMsg($actionRequest), $actionRequest);
        }

        // Setting all request parameters with the given values (request parameters array)
        try {
            // Merging request headers with common dynamic headers
            $headersValue = array_merge($this->commonDynamicHeaders, $headersValue);
            $actionRequest->configure($requestParameters, $content, $urlBuildParameters, $headersValue);
        } catch (\Exception $ex) {
            throw new NotConfiguredActionException(
                sprintf(
                    '[%s] An error occured while configuring the action \'%s\': \'%s\'.',
                    $this->getApiName(),
                    $actionName,
                    $ex->getMessage()
                ),
                $actionRequest
            );
        }

        // We configure the Zend\Http\Client object and we send the request
        $actionRequest->setClientEncType($this->client);

        // Getting the response
        $response = null;
        try {
            $response = $this->client->send($actionRequest);
        } catch (ZendExceptionInterface $ze) {
            throw new UnsuccessApiActionException(
                sprintf(
                    '[%s] An exception was caught while running the action \'%s\'. Error code \'%s\', message \'%s\'.',
                    $this->getApiName(),
                    $actionName,
                    $ze->getCode(),
                    $ze->getMessage()
                ),
                $actionRequest,
                $response
            );
        }

        // Getting a proper ActionResponseInterface object instance
        $responseObj = $this->getResponseInstance(
            $actionRequest->getResponseType(),
            $actionRequest->getResponseWrapper()
        );

        // We check if there is a response object defined. If yes, we wrap its main content into a response wrapper object;
        if ($responseObj instanceof ActionResponseInterface) {
            $responseObj->setResponse($response);
            $responseObj->setRequestName($actionName);
            return $responseObj->getParsedResponse();
        }
        // if not, we return a null value.
        return null;
    }
public function execute(
        $actionName,
        array $requestParameters = array(),
        $content = "",
        array $urlBuildParameters = array(),
        array $headersValue = array()
    ) {
        // Getting configured action request object
        $actionRequest = $this->getActionRequestByName($actionName);
        if (!$actionRequest instanceof AbstractActionRequest) {
            throw new BadConfiguredActionException($this->getNotValidRequestExMsg($actionRequest), $actionRequest);
        }

        // Setting all request parameters with the given values (request parameters array)
        try {
            // Merging request headers with common dynamic headers
            $headersValue = array_merge($this->commonDynamicHeaders, $headersValue);
            $actionRequest->configure($requestParameters, $content, $urlBuildParameters, $headersValue);
        } catch (\Exception $ex) {
            throw new NotConfiguredActionException(
                sprintf(
                    '[%s] An error occured while configuring the action \'%s\': \'%s\'.',
                    $this->getApiName(),
                    $actionName,
                    $ex->getMessage()
                ),
                $actionRequest
            );
        }

        // We configure the Zend\Http\Client object and we send the request
        $actionRequest->setClientEncType($this->client);

        // Getting the response
        $response = null;
        try {
            $response = $this->client->send($actionRequest);
        } catch (ZendExceptionInterface $ze) {
            throw new UnsuccessApiActionException(
                sprintf(
                    '[%s] An exception was caught while running the action \'%s\'. Error code \'%s\', message \'%s\'.',
                    $this->getApiName(),
                    $actionName,
                    $ze->getCode(),
                    $ze->getMessage()
                ),
                $actionRequest,
                $response
            );
        }

        // Getting a proper ActionResponseInterface object instance
        $responseObj = $this->getResponseInstance(
            $actionRequest->getResponseType(),
            $actionRequest->getResponseWrapper()
        );

        // We check if there is a response object defined. If yes, we wrap its main content into a response wrapper object;
        if ($responseObj instanceof ActionResponseInterface) {
            $responseObj->setResponse($response);
            $responseObj->setRequestName($actionName);
            return $responseObj->getParsedResponse();
        }
        // if not, we return a null value.
        return null;
    }
public function execute ( $ actionName , array $ requestParameters = array ( ) , $ content = "" , array $ urlBuildParameters = array ( ) , array $ headersValue = array ( ) ) { // Getting configured action request object $ actionRequest = $ this -> getActionRequestByName ( $ actionName ) ; if ( ! $ actionRequest instanceof AbstractActionRequest ) { throw new BadConfiguredActionException ( $ this -> getNotValidRequestExMsg ( $ actionRequest ) , $ actionRequest ) ; } // Setting all request parameters with the given values (request parameters array) try { // Merging request headers with common dynamic headers $ headersValue = array_merge ( $ this -> commonDynamicHeaders , $ headersValue ) ; $ actionRequest -> configure ( $ requestParameters , $ content , $ urlBuildParameters , $ headersValue ) ; } catch ( \ Exception $ ex ) { throw new NotConfiguredActionException ( sprintf ( '[%s] An error occured while configuring the action \'%s\': \'%s\'.' , $ this -> getApiName ( ) , $ actionName , $ ex -> getMessage ( ) ) , $ actionRequest ) ; } // We configure the Zend\Http\Client object and we send the request $ actionRequest -> setClientEncType ( $ this -> client ) ; // Getting the response $ response = null ; try { $ response = $ this -> client -> send ( $ actionRequest ) ; } catch ( ZendExceptionInterface $ ze ) { throw new UnsuccessApiActionException ( sprintf ( '[%s] An exception was caught while running the action \'%s\'. Error code \'%s\', message \'%s\'.' , $ this -> getApiName ( ) , $ actionName , $ ze -> getCode ( ) , $ ze -> getMessage ( ) ) , $ actionRequest , $ response ) ; } // Getting a proper ActionResponseInterface object instance $ responseObj = $ this -> getResponseInstance ( $ actionRequest -> getResponseType ( ) , $ actionRequest -> getResponseWrapper ( ) ) ; // We check if there is a response object defined. If yes, we wrap its main content into a response wrapper object; if ( $ responseObj instanceof ActionResponseInterface ) { $ responseObj -> setResponse ( $ response ) ; $ responseObj -> setRequestName ( $ actionName ) ; return $ responseObj -> getParsedResponse ( ) ; } // if not, we return a null value. return null ; }
Executes a remote api action by action name

@param string $actionName         the action name to execute
@param array  $requestParameters  the request parameters (keys/values) to use in the action execution
@param string $content            the content to be set in the body of the request
@param array  $urlBuildParameters the url build adds on parameter array
@param array  $headersValue       the header value array to override default header values

@return null|\Msl\RemoteHost\Response\Wrapper\ResponseWrapperInterface

@throws \Msl\RemoteHost\Exception\NotConfiguredActionException
@throws \Msl\RemoteHost\Exception\BadConfiguredActionException
@throws \Msl\RemoteHost\Exception\UnsuccessApiActionException
Executes a remote api action by action name