致命错误:未捕获的SoapFault异常:[客户端]函数(“AuthenticationHeader”)在D:\ xampp \ htdocs \ soap \ index_2.php中不是此服务的有效方法:132堆栈跟踪:#0 D:\ xampp \ htdocs \ soap \ index_2.php(132):SoapClient-> __ call('AuthenticationH ...',Array)#1 D:\ xampp \ htdocs \ soap \ index_2.php(132):SoapClient->在第132行的D:\ xampp \ htdocs \ soap \ index_2.php中抛出AuthenticationHeader(数组)#2 {main}
答案 0 :(得分:0)
必须只有一个请求,您发送三个。你必须创建这样的东西:
1)设置用于身份验证的标头:
$auth = $auth = new SOAPAuth('USERNAME', 'PASSWORD');
$header = new SOAPHeader('urn:example.org/auth', 'AuthenticationHeader', $auth);
$client->__setSoapHeaders($header);
2)使用消息文本和联系人创建创建请求。
$result = $client->SendSMSToContacts(array("MessageText" => "some text", "contactIDs" => array(123456789, 123456789));
P.S. For the debugging create client with:
$client = new SoapClient($url, array('trace' => 1,
'exceptions' => 1,));
and after sending request, look on request that was sended and resopnse on it:
var_dump("REQUEST=", $client->__getLastRequest());
var_dump("RESPONSE=", $client->__getLastResponse());
如果查看错误代码,您会看到AuthenticationHeader不是一种方法!错误非常清楚!
使用this
或下载soap ui。 (google it!)
你会看到有什么方法可供使用!