PHP SOAP调用失败,标头发送问题

时间:2016-04-17 17:53:41

标签: php soap

我需要使用值1234进行肥皂调用“GetCommitQueueData” 我需要让auth绕过HTTP身份验证 我还需要在标题中传递用户名,密码和ID,但每次它告诉我id不发送,这里是我的代码,也许有人可以提供帮助:

$username = 'myuser';
$password = 'mypass';  
$idi = "3445-343534-453453-343-344"; 
ini_set('soap.wsdl_cache_enabled', false);
$client = new SoapClient("https://localhost.com/myfile.wsdl", array('trace' => 1, 'login'    => 'myuser',
        'password' => 'mypass', 'Request-Id' => $idi));



$ns = 'http://foreignhost.com/AdminAPI_Admin'; //Namespace of the WS. 

//Body of the Soap Header. 
$headerbody = array('UserName' => $username, 
                    'Password' => $password, 
                    'Request-Id'=>$idi); 

$header = new SOAPHeader($ns, 'RequestorCredentials', $headerbody);        

$client->__setSoapHeaders($header); 


show($client->__getFunctions()); 

$info = $client->__soapCall("GetCommitQueueData", array('1234' ));
show($info); 



function show($data){
    echo "<pre>";
    print_r($data); 
    echo "</pre>";
}

我收到此错误:

  

致命错误:未捕获的SoapFault异常:[a:InternalServiceFault]标题中缺少Request-Id

如果使用nusoap有更简单的解决方案,请告诉我

0 个答案:

没有答案