| 310 | |
| 311 | // Tworzy sprawę |
| 312 | $prc_id = NULL; |
| 313 | |
| 314 | try { |
| 315 | $data = array( |
| 316 | 'dscrpt' => 'SOAP TEST '.date('d H:m:s'), |
| 317 | 'briefcase_symbol' => 'DK.023', |
| 318 | 'orunid' => 49, |
| 319 | 'rspoid' => 54, |
| 320 | 'fxtrid' => 60, |
| 321 | 'prtpid' => 1, |
| 322 | ); |
| 323 | $prc_id = $client->createProcess($data); |
| 324 | var_dump($prc_id); |
| 325 | |
| 326 | } catch(SoapFault $fault) { |
| 327 | |
| 328 | var_dump($fault); |
| 329 | |
| 330 | if ($fault->faultcode < 100) { |
| 331 | trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR); |
| 332 | } |
| 333 | } |
| 334 | |
| 335 | // tworzy dokument w sprawie |
| 336 | if ($prc_id) { |
| 337 | |
| 338 | $doc_id = NULL; |
| 339 | |
| 340 | try { |
| 341 | $data = array( |
| 342 | 'dscrpt' => 'SOAP TEST '.date('d H:m:s'), |
| 343 | 'prc_id' => $prc_id, |
| 344 | 'dctpid' => 1, |
| 345 | 'target' => 54, |
| 346 | 'from_contact_symbol' => '12345', |
| 347 | 'to_contact_symbol' => '54321', |
| 348 | ); |
| 349 | $doc_id = $client->createDocument($data); |
| 350 | var_dump($doc_id); |
| 351 | |
| 352 | } catch(SoapFault $fault) { |
| 353 | |
| 354 | var_dump($fault); |
| 355 | |
| 356 | if ($fault->faultcode < 100) { |
| 357 | trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR); |
| 358 | } |
| 359 | } |
| 360 | |
| 361 | // dodaje załącznik do utworzonego dokumentu |
| 362 | // o treści Testowy plik i nazwie dokument.txt |
| 363 | if ($doc_id) { |
| 364 | try { |
| 365 | $file = base64_encode(file_get_contents('test.pdf')); |
| 366 | $fname = 'test.pdf'; |
| 367 | |
| 368 | $dd = $client->addAttachmentToDocument($file, $fname, $doc_id); |
| 369 | var_dump($dd); |
| 370 | |
| 371 | } catch(SoapFault $fault) { |
| 372 | |
| 373 | var_dump($fault); |
| 374 | |
| 375 | if ($fault->faultcode < 100) { |
| 376 | trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR); |
| 377 | } |
| 378 | } |
| 379 | } |
| 380 | } |
| 381 | |