用的PHP5的Soap,不是nusoap.两个问题
1.SoapHeader如何发送出去
我代码如下:相关疑问是注释部分$client = new SoapClient('http://127.0.0.1/server.php?WSDL); 
class authentication_header {
private $username;
private $password;
public function __construct($username,$password) {
$this->username=$username;
$this->password=$password;
}
}
$auth = new authentication_header('myuser','secret');
// create authentication header values
$authvalues = new SoapVar($auth,SOAP_ENC_OBJECT,'authenticate');
// generate header
$header = new SoapHeader("myURN","authenticate",$authvalues,false,"http://schemas.xmlsoap.org/soap/actor/next");
//$client->__setSoapHeaders(array($header)); //此行的功效是否会在__call的时候传递header?
$client->soap_defencoding='utf-8';
$client->decode_utf8=false;
$client->xml_encoding = 'utf-8';$client->__call('login',array('username'=>'s','userpass'=>'f'),false,$header,$out);//此行报错Fatal error: SoapClient::__call() [<a href='function.SoapClient---call'>function.SoapClient---call</a>]: first parameter must be string or null,换成__soapCall也报同样的错误
2.以上是发送程序,请问我用php如何写接收header的程序?也就是如何让服务器端知道我发送的Header中的username和passwordrequire './test_class.php';$server = new SoapServer('./TestWSDL.wsdl');//用ZDE生成的一个wsdl
$server->setClass('CTest');
$server->handle();//如何接收username和password????