Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> SOAP pierwsze kroki
smiady
post
Post #1





Grupa: Zarejestrowani
Postów: 137
Pomógł: 2
Dołączył: 2.07.2007
Skąd: Ostrzeszów

Ostrzeżenie: (0%)
-----


Zdobywam wiedzę i uczę się SOAPa i mam taki kod:

Plik SoapName.php
  1. class Name {
  2. private $full_name;
  3.  
  4. public function createName($first_name, $second_name) {
  5. $first= strtoupper(substr($first_name, 0, 1));
  6. $second= ucfirst(strtolower($second_name));
  7.  
  8. $this->full_name= $first . '. ' . $second;
  9.  
  10. return $this->full_name;
  11. }
  12.  
  13. public function countName() {
  14. return strlen($this->full_name);
  15. }
  16. }
  17.  
  18. $options= array('uri' => 'http://localhost/soap');
  19. $server= new SoapServer(NULL, $options);
  20. $server->setClass('Name');
  21. $server->handle();


index.php
  1. try {
  2. $options= array('uri' => 'http://localhost/soap',
  3. 'location' => 'http://localhost/soap/SoapName.php');
  4. $client= new SoapClient(NULL, $options);
  5. echo $client->createName('alicja', 'kowalska');
  6. } catch(Exception $e) {
  7. echo $e->getMessage();
  8. }


Klasa jest dobrze napisana, bo sprawdzałem, ale niestety wyskakuje mi taki wyjątek:
DTD are not supported by SOAP
Czy ktoś się kiedyś z takim problemem spotkał ?

Ten post edytował smiady 4.07.2014, 18:38:02
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 4)
wladimirec
post
Post #2





Grupa: Zarejestrowani
Postów: 28
Pomógł: 7
Dołączył: 27.10.2004

Ostrzeżenie: (0%)
-----


Kod wygląda dobrze i działa (SOA #1).
A próbowałeś ustawić opcję 'trace' => true w kliencie i sprawdzić co zwracają metody
SoapClient->__getLastRequest, SoapClient->__getLastRequestHeaders, SoapClient->__getLastResponse, SoapClient->__getLastResponseHeaders ?
Go to the top of the page
+Quote Post
smiady
post
Post #3





Grupa: Zarejestrowani
Postów: 137
Pomógł: 2
Dołączył: 2.07.2007
Skąd: Ostrzeszów

Ostrzeżenie: (0%)
-----


Dzięki za zainteresowanie.

Dopisałem kod: echo $client->__getLastRequest;
W $options ustawiłem 'trace' => true
Niestety komunikat nadal jest taki sam ...
Go to the top of the page
+Quote Post
wladimirec
post
Post #4





Grupa: Zarejestrowani
Postów: 28
Pomógł: 7
Dołączył: 27.10.2004

Ostrzeżenie: (0%)
-----


przede wszystkim sprawdź co zwraca
SoapClient->__getLastResponse i SoapClient->__getLastResponseHeaders

Ten post edytował wladimirec 9.07.2014, 20:39:51
Go to the top of the page
+Quote Post
Spawnm
post
Post #5





Grupa: Moderatorzy
Postów: 4 069
Pomógł: 497
Dołączył: 11.05.2007
Skąd: Warszawa




Na dev serwie warto ustawić ini_set('soap.wsdl_cache_enabled', 0);
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 23:25