1 class SoapUserInfo {
2 public $UserID;
3 public $Password;
4 public function __construct($l, $p) {
5 $this->Password = $p;
6 $this->UserID = $l;
7 }
8 }
9 try {
10 //创建客户端
11 $client = new SoapClient("http://******/?wsdl");
12 $reversed = $client->__getFunctions ();
13 print_r($reversed);
14 //SoapHeader(目标命名(targerNamespace),"消息参数",结构体(用户名及密码封装), false, SOAP_ACTOR_NEXT)
15 $header = new SoapHeader("targerNamespace", 'targerMessage', new SoapUserInfo('users', 'password'), false, SOAP_ACTOR_NEXT);
16 $client->__setSoapHeaders($header);
17 echo $client->__Call('Test',array('parameters'=>array('Test'=>"")))->TestResult;
18 }
19 catch(Exception $e){}