mam problem z serwerem i klientem SOAP, a mianowicie:

jest sobie serwer SOAP:

  1. <?php
  2. require_once( "gilotyna.class.php" );
  3. $server = new SoapServer( "gilotyna.wsdl" );
  4. $server->setClass("gilotyna", "testowy kod" );
  5. $server->handle();
  6. ?>



klasa gilotyna:

  1. <?php
  2. class gilotyna
  3. {
  4. private $strShopKey = NULL;
  5. private $strUserKey = NULL;
  6. private $arrMessage = NULL;
  7.  
  8. private $arrError = array(
  9. '0' => array ('0' => 'Brak wprowadzonego kodu użytkownika.')
  10.  );
  11.  
  12. public function __construct( $strShopKey = 'test' )
  13. {
  14. $this->strShopKey = $strShopKey;
  15. }
  16.  
  17.  
  18. public function test( $str )
  19. {
  20. return $str;
  21. }
  22.  
  23.  
  24. public function setShopKey( $strShopKey )
  25. {
  26. $this->strShopKey = $strShopKey;
  27. }
  28.  
  29.  
  30. public function setUserKey( $strUserKey )
  31. {
  32. $this->strUserKey = $strUserKey;
  33. }
  34.  
  35. public function getMessage()
  36. {
  37. return $this->arrMessage;
  38. }
  39.  
  40.  
  41. public function checkUserKey()
  42. {
  43. try
  44. {
  45. if ( $this->strUserKey == NULL )
  46. {
  47. throw new Exception ( '0' );
  48. }
  49.  
  50. return true;
  51. }
  52. catch ( Exception $e )
  53. {
  54. $this->arrMessage = $this->arrError[$e->getMessage()];
  55. return false;
  56. }
  57. }
  58. }
  59. ?>



i klient:

  1. <?php
  2. $objClient = new SoapClient('http://localhost/gilotynaSoapServer/gilotyna.wsdl' );
  3. $objClient->setShopKey( 'KEYTESTOWY' );
  4. if ( $objClient->checkUserKey())
  5. {
  6. echo 'ok';
  7. }
  8. else
  9. {
  10. echo 'blad';
  11. echo '<pre>';
  12. print_r($objClient->getMessage());
  13. echo '</pre>';
  14. }
  15. ?>





Mój problem polega na tym, że jak się łączy i sprawdza
  1. <?php
  2. if ( $objClient->checkUserKey())
  3. ?>


wyswietla na ekranie "blad", natomiast:
  1. <?php
  2. echo '<pre>';
  3. print_r($objClient->getMessage());
  4. echo '</pre>';
  5. ?>


nie wyswietla nic, czyli nie działa to:

  1. <?php
  2. $this->arrMessage = $this->arrError[$e->getMessage()];
  3. ?>


wyglada to tak jakby pola pomiedzy metodami klasy sie nie przypisywaly.

Spotkał się z tym już ktoś, w czym może być problem??
nie wyswietla nic