文字

SoapServer::__construct

(PHP 5 >= 5.0.1)

SoapServer::__constructSoapServer constructor

说明

public SoapServer::__construct ( mixed $wsdl [, array $options ] )

此函数是该函数的别名: SoapServer::SoapServer()

用户评论:

[#1] Anonymous [2012-06-10 14:35:53]

// 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'    => ));

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


// Hope you like it

上一篇: 下一篇: