| 1 | = Dodaj dokument do sprawy = |
| 2 | |
| 3 | ''' Definicja parametrów: ''' |
| 4 | {{{ |
| 5 | #!php |
| 6 | <?php |
| 7 | |
| 8 | /** |
| 9 | * Dodaj dokument do sprawy |
| 10 | * |
| 11 | * @param data['doc_id'] Int - identyfikator dokumentu (documents:doc_id) |
| 12 | * @param data['prc_id'] Int - identyfikator sprawy (processes:prc_id) |
| 13 | * |
| 14 | * @return TRUE - jeśli sukces inaczej wyjątek |
| 15 | * |
| 16 | * @throws Exception - SoapFault |
| 17 | */ |
| 18 | |
| 19 | Array attachDocumentToProcess(Array data) |
| 20 | |
| 21 | ?> |
| 22 | }}} |
| 23 | |
| 24 | ''' Przykłady wywołań: ''' |
| 25 | {{{ |
| 26 | #!php |
| 27 | |
| 28 | // Plik MyService.php umieszczony w apps/edokumenty. |
| 29 | // MyService.php |
| 30 | <?php |
| 31 | |
| 32 | define('EDOK_API_LOGIN', 'developer'); |
| 33 | define('EDOK_API_PASSWORD', 'developer'); |
| 34 | define('DEFAULT_ENTITY_SYMBOL', 'demo'); |
| 35 | |
| 36 | require_once('./classes/eDokumentyApi/EDokApiClient.inc'); |
| 37 | |
| 38 | $options = array( |
| 39 | 'location' => 'http://{host}:{port}/eDokumentyApi.php', |
| 40 | "uri" => "eDokumentyAPI", |
| 41 | 'encoding'=>'UTF-8' |
| 42 | ); |
| 43 | |
| 44 | $client = new EDokApiClient(NULL, $options); |
| 45 | $client->setUser(EDOK_API_LOGIN); |
| 46 | $client->setPass(md5(EDOK_API_PASSWORD)); |
| 47 | $header = new SoapHeader('eDokumentyAPI', 'entity_symbol', DEFAULT_ENTITY_SYMBOL); |
| 48 | $client->__setSoapHeaders($header); |
| 49 | |
| 50 | |
| 51 | $element = array(); |
| 52 | |
| 53 | try { |
| 54 | $out = $client->attachDocumentToProcess(5, 6); |
| 55 | var_dump($out); |
| 56 | |
| 57 | } catch(SoapFault $fault) { |
| 58 | |
| 59 | var_dump($fault); |
| 60 | |
| 61 | if ($fault->faultcode < 100) { |
| 62 | trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR); |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | ?> |
| 67 | }}} |