Mapweb / M-Storage Web

Web Services

De MappingDoc
Révision datée du 6 mars 2019 à 09:11 par imported>Admin (1 révision importée)
(diff) ← Version précédente | Voir la version actuelle (diff) | Version suivante → (diff)

Modèle:Box Modèle:Bloc

Modèle:BlocEndModèle:Bloc

Prerequisites

Modèle:Bloc Before interrogating web services, it is necessary to congfigure and get the SOAP server client token, version 1.2.

Be sure to enable SOAP Extension in your php.ini file and before send any request get the client token with this call :

$wsdl = "http://127.0.0.1/MapWebFiles/module/Soap/MapSoap.wsdl";      // WSDL path : http://<your_server_adress>/MapWebFiles/module/Soap/MapSoap.wsdl 
$client = new SoapClient($wsdl , array("soap_version" => SOAP_1_2));  // Mapweb / M-Storage Web need SOAP version 1.2 

For examples below, each call to web service function will be done with the client token. Modèle:BlocEnd

Functions

Modèle:Bloc

getCriteres

Récupère la liste des critères disponibles en fonction du ou des volumes passés en paramètres. Les volumes ne sont pas obligatoires.

HTTP Method : POST

Parameters

Parameter Name Type Required Description
login String Y User login
passwd String Y User password encrypted md5
volumes Array[String] N Volumes list

Example Webservice Call

  • PHP
/* Set parameters to provide to getCriteres() function  */
$parameters = array(
              "login" => "userLogin",             // User login 
              "passwd" => md5("userPassword"),    // User password encrypted md5 
               "volumes" => array(                // 'Volumes' list, can be defined with getVolumes() 
                            "Invoices",
                            "Templates",
                            "Others"
                            );
               );

$aCriteria = $client -> getCriteres($parameters); // $aCriteria is an array, see Example Webservice Response in this chapter for more details.

Example Webservice Response

  • PHP
getCriteresResult  => 
array(
  Critere => 
  array(
    "m_critere"        => "c_date",    // Criterion name 
    "m_type"           => "varchar",   // Variable type 
    "m_format"         => "",          // Value format, Ex: Azaz09 
    "m_description"    => "date",      // Criterion description 
    "m_visu"           => "vu",        // Define if the criterion is hide or visible 
    "m_visuSearch"     => ""           // Define if the crierion is hide or visible for a search 
  );
);

Tips

  • PHP
/* $aCriteria contains, for each criterion, all availables values. Here an example to only retrieve names value, see Example Webservice Response in this chapter for more details about availables values */
$aCriteriaNames = array();
if(count($aCriteria->getCriteresResult->Critere) > 1)    // If the web service returned criterias 
{
  foreach($aCriteria->getCriteresResult as $criterion)
  {
    array_push($aCriteriaNames, $criterion->m_critere);  // For each criterion, push the name value to array $aCriteriaNames
  }
}

Error Messages

Modifiable selon la gestion des erreurs

{
   "exception": "invalid_parameter_exception",
   "errorcode": "invalidparameter",
   "message": "Invalid parameter value detected"
}

Modèle:BlocEnd Modèle:BlocEnd Modèle:BoxEnd