我是php新手。我有个问题。我想使用nusoap从soap获取数据,但始终会抛出无效的用户名或密码。我如何在下面设置标题?谢谢!
function GetClaimFile(){
global $gb_msurucuaddress,$gb_msuusername,$gb_msupassword;
error_reporting(E_ALL | E_STRICT);
require_once('nusoap/lib/nusoap.php');
$client = new nusoap_client($gb_msurucuaddress, true);
$header ='<AuthenticationHeader>'.
'<UserName>'.$gb_msuusername.'</UserName>'.
'<Password>'.$gb_msupassword.'</Password>'.
'</AuthenticationHeader>';
echo $header;
$client->setHeaders($header);
$parameters['DosyaNo'] = 1312;
$response = $client->call('HavuzSorgula',$parameters);
var_dump($response);
if ($client->fault) {
} else {
// Check for errors
$err = $client->getError();
if ($err) {
// Display the error
} else {
print_r($response);
}
}
}
if(isset($_POST['submit_get'])) {
GetClaimFile();
}
我在执行请求时需要此xml输出。
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/">
<soap:Header>
<tem:AuthenticationHeader>
<!--Optional:-->
<tem:UserName>xxxx</tem:UserName>
<!--Optional:-->
<tem:Password>xxxx</tem:Password>
</tem:AuthenticationHeader>
</soap:Header>
<soap:Body>
<tem:HavuzSorgula>
<!--Optional:-->
<tem:girdi>
<tem:DosyaNo>1312</tem:DosyaNo>
</tem:girdi>
</tem:HavuzSorgula>
</soap:Body>
</soap:Envelope>