Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用WSDL URL的基本身份验证调用soap api_Soap - Fatal编程技术网

如何使用WSDL URL的基本身份验证调用soap api

如何使用WSDL URL的基本身份验证调用soap api,soap,Soap,大宗报价 我们正在使用Soap API,但无法连接到服务器。我是Soap API新手 我们正在使用代码 username = testclient password = tes@123 try { $client=new SoapClient($wsdl,array('trace' => 1,"stream_context" => $context)); $result = $client->__call('getStatus', array()); } cat

大宗报价

我们正在使用Soap API,但无法连接到服务器。我是Soap API新手

我们正在使用代码

username = testclient
password = tes@123
try { 
   $client=new SoapClient($wsdl,array('trace' => 1,"stream_context" => $context));

   $result = $client->__call('getStatus', array());
} catch (Exception $e) { 
   echo $e->getMessage();
}
在通过头球之后

$client = new SoapClient(
    'https://test/app/uat/test?wsdl', 
    array( 
       "exceptions" => 0, 
       "trace" => 1, 
       'stream_context' => stream_context_create(array( 
                     'http' => array( 'header' => 'Authorization: Basic dGVzdGNsaWVudDp0ZXN0QDEyMw==' ), 
                           )), 
        )); 
    $result = $client->__soapCall('getBalance', array());
我们也有客户端和机密,但我们如何使用基本身份验证

我们可以在这里设置用户、密码和密钥

如果你需要什么,请告诉我


谢谢

您可以在请求中添加一个
授权:Basic base64encodedusernamedpassword
HTTP头,其中用户名和密码需要首先以
用户名:密码
的形式进行base64编码。您可以提供一个示例吗?我们如何发送HTTP头?因为您已经有一个流你可以写更多的标题,谢谢你的回复。但是我们会像你一样使用<代码>$client=新的SoapClient('https://test/app/uat/test?wsdl“,数组(“异常”=>0,“跟踪”=>1,“流上下文”=>流上下文”=>$结果=$client->uu soapCall('getBalance',array())但有时出现空白屏幕,有时无法连接到服务器。您可以向请求添加
授权:Basic base64EncodedUsernameAndPassword
HTTP头,其中用户名和密码需要以
用户名:密码
的形式首先进行base64编码。您能否提供一个可能的副本示例?我们如何发送HTTP头?因为您已经有了一个流上下文,您可以编写其他头,谢谢您的回复。但是我们使用的是您自己的<代码>$client=新的SoapClient('https://test/app/uat/test?wsdl“,数组(“异常”=>0,“跟踪”=>1,“流上下文”=>流上下文”=>$结果=$client->uu soapCall('getBalance',array())但有时是空白屏幕,有时无法连接到服务器。