SoapServer::__construct

(PHP 5, PHP 7)

SoapServer::__constructSoapServer constructor

Descrierea

public SoapServer::__construct ( string|null $wsdl , array $options = [] )

Această funcție este pseudonim pentru: SoapServer::SoapServer()

add a note add a note

User Contributed Notes 1 note

up
4
Anonymous
12 years ago
// Workin Server with Client for localhost

// server.php

<?php
class MyClass {
  public function
helloWorld() {

    return
'Hallo Welt '. print_r(func_get_args(), true);
  }
}

try {
 
$server = new SOAPServer(
   
NULL,
    array(
    
'uri' => 'http://localhost/soap/server.php'
   
)
  );

 
$server->setClass('MyClass');
 
$server->handle();
}

catch (
SOAPFault $f) {
  print
$f->faultstring;
}

?>

// client.php:

<?php
$client
= new SoapClient(null, array(
     
'location' => "http://localhost/soap/server.php",
     
'uri'      => "http://localhost/soap/server.php",
     
'trace'    => 1 ));

echo
$return = $client->__soapCall("helloWorld",array("world"));
?>

// Hope you like it
To Top