Navigation:  Integration via SOAP web services > Technical overview >

API Key authentication

Previous  Top  Next

The request to the API Gateway must be made passing in the header of the request the Authorization parameter with the personal user token that is available in the "API Gateway" section of the user data screen:

 

account_01

 

account_02

 

The SoapUI is a tool used for testing web service applications. See in the image below an example of how to use the header in SoapUI:

 

soapui_apikey_zoom80

 

To perform the connection with one of our SOAP web services through an external php file, we suggest the use of the soap extension (native to PHP) according to the example below:

 

<?php

// Server domain or server ip

$server = "alves.softexpert.com.br";

 

//Local WSDL File (in this sample we are using SE Administration WebService)

//$wsdl     = "adm_ws.wsdl";

//URL to download a remote WSDL

$wsdl     = "https://$server/se/ws/adm_ws.php?wsdl";

 

//endpoint to connect

$location = "https://$server/apigateway/se/ws/adm_ws.php";

 

//Http request context (you should set the Authorization Token). In context details you can disable ssl feature (https://www.php.net/manual/pt_BR/context.ssl.php)

$context = array(

   'http' => array(

       'header' => 'Authorization: userToken' //user token catured in your sesuite account details

   ));

 

 

#$client = new SoapClient($wsdl,array(

 "trace" => 1, // enable trace

 "exceptions" => 1, // enable exceptions

 "stream_context" => stream_context_create($context),

 "location" => $location

));

 

//below we are using a sample method in SE Administration WebService

$return = $client->editPosition(array(

 'ID' => "SamplePosition",

 'DESC' => "SamplePosition"

));

 

It is possible to ignore the SSL protocol in this context simply by editing the value of the context variable. According to the example below:

//Http request context (you should set the Authorization Token). In context details you can disable ssl feature (https://www.php.net/manual/pt_BR/context.ssl.php)

$context = array(

   'http' => array(

       'header' => 'Authorization: userToken'

   ),

   'ssl' => array(

       'verify_peer' => false,

       'verify_peer_name' => false

   )

);

 

It is necessary to have enabled the SOAP and OpenSSL extensions within the used PHP configurations (php.ini).

 

If it is necessary to perform a connection with one of our webservices through an internal file of the SoftExpert Suite tool (such as an external application), it is possible to simplify it by using a method we have created in it for this purpose. See below an example of this call, which can be added to the source of the respective external application:

//SoapGateway is located within /include/dataintegration/apigateway/class.SoapGateway.inc

$soapGateway = new SoapGateway("user_token_here", "alves.softexpert.com.br");

$return = $soapGateway->call();

 

See below the record of the call() method mentioned above to express the possible parameters and their features.

/**

    * Method that calls a method of the respective SoftExpert Suite Soap web service.

    * @param String $params Array with the request structure

    * @param String $resourcePath Path of the web service to be called. It is usually similar to se/ws/<component_code>_ws.php Ex.: se/ws/adm_ws.

    * @param String $soapAction Method that will be called in the respective webservice.

    */

  public function call($params = array('ID' => "SamplePosition", 'DESC' => "SamplePosition"), $resourcePath = "se/ws/adm_ws.php", $soapAction = "editPosition")