Zmiany pomiędzy wersją 1 and wersją 2 dla DeployerGuide/Others/eDokumentyApi/GetProduct

Pokaż
Ignoruj:
Data i czas:
01/28/15 11:18:51 (9 years temu)
Autor:
WN (IP: 79.188.124.105)
Komentarz:

--

Legend:

Bez zmian
Dodane
Usunięte
Zmienione
  • DeployerGuide/Others/eDokumentyApi/GetProduct

    v1 v2  
    1 1 
     1= [wiki:DeployerGuide Przewodnik wdrożeniowca] > Pobierz dane produktu = 
     2 
     3 
     4=  Odczytanie danych produktu = 
     5 
     6 
     7''' Definicja parametrów: ''' 
     8{{{ 
     9#!php 
     10<?php 
     11 
     12/** 
     13 *  Zwraca dane produktu o przekazanym w parametrze identyfikatorze 
     14 *    
     15 *  @param depoid Int - identyfikator produktu (depository.depoid) 
     16 *  @param return_json Boolean - określa postać w jakiej zostanie zwrócony wynik (false - tablica; true - JSON), domyślnie false 
     17 *    
     18 *  @return Array - tablica asocjacyjna z danymi produktu, SoapFault w razie niepowodzenia 
     19 *    
     20 *  @throws Exception - SoapFault 
     21 */ 
     22Array getProducts(Int depoid, Boolean return_json = false) 
     23 
     24?> 
     25}}} 
     26 
     27''' Przykłady wywołań: ''' 
     28{{{ 
     29#!php 
     30 
     31// Plik MyService.php umieszczony w apps/edokumenty. 
     32// MyService.php 
     33<?php 
     34 
     35define('EDOK_API_LOGIN', 'developer'); 
     36define('EDOK_API_PASSWORD', 'developer'); 
     37define('DEFAULT_ENTITY_SYMBOL', 'demo'); 
     38 
     39require_once('./classes/eDokumentyApi/EDokApiClient.inc'); 
     40 
     41$options = array( 
     42    'location' => 'http://{host}:{port}/eDokumentyApi.php', 
     43    "uri" => "eDokumentyAPI", 
     44    'encoding'=>'UTF-8' 
     45); 
     46         
     47$client = new EDokApiClient(NULL, $options); 
     48$client->setUser(EDOK_API_LOGIN); 
     49$client->setPass(md5(EDOK_API_PASSWORD)); 
     50$header = new SoapHeader('eDokumentyAPI', 'entity_symbol', DEFAULT_ENTITY_SYMBOL); 
     51$client->__setSoapHeaders($header); 
     52 
     53 
     54$product = null; 
     55$depoid = 9; 
     56 
     57try { 
     58     
     59    $product = $client->searchDocuments($depoid, false); 
     60    var_dump($product); 
     61 
     62} catch(SoapFault $fault) { 
     63     
     64    var_dump($fault); 
     65     
     66    if ($fault->faultcode < 100) { 
     67        trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR); 
     68    } 
     69} 
     70 
     71?> 
     72}}}