【发布时间】:2019-07-25 12:01:24
【问题描述】:
我正在尝试连接到需要 Windows 身份验证的 Web 服务。
我正在用 PHP 编写代码并尝试调用 MS dynamics 365 wsdl 的方法
但我得到的只是Forbidden 和608 error code: There is insufficient account information to log you on.
我尝试了NTLMSoapClient 和NuSoap 类,但是当它没有抛出Forbidden 消息时,它给了我空对象的NULL 值,最终仍然没有得到方法的响应.
我的代码是这样的
<?php
$login = "user@dynamicsaccount.com";
$password = "password";
$url = "https://domainname.sandbox.ax.dynamics.com/pathto/soap/service/someservice?wsdl";
$arrayOpt = array(
"soap_version" => SOAP_1_1,
"cache_wsdl" =>WSDL_CACHE_NONE,
"exceptions" =>false,
"trace" =>true,
'authentication'=> SOAP_AUTHENTICATION_BASIC,
'login' =>$login,
'password' =>$password
);
$client = new SoapClient($url, $arrayOpt);
$param = array('someParam' => "value");
print_r($client->__getFunctions()); // i get the full functions from the wsdl
$result = $client->getInfo($param);
var_dump($result); // i get a:Forbidden [Message]=>string(55) "There is insufficient account information to log you on"
?>
即使我使用SOAPUI 我得到相同的结果
<s:Fault>
<faultcode xmlns:a="http://schemas.microsoft.com/2009/WebFault">a:Forbidden</faultcode>
<faultstring xml:lang="en-US">Forbidden</faultstring>
<detail>
<Win32Exception xmlns="http://schemas.datacontract.org/2004/07/System.ComponentModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:x="http://www.w3.org/2001/XMLSchema">
<NativeErrorCode i:type="x:int" xmlns="">608</NativeErrorCode>
<ClassName i:type="x:string" xmlns="">System.ComponentModel.Win32Exception</ClassName>
<Message i:type="x:string" xmlns="">There is insufficient account information to log you on</Message>
<Data i:nil="true" xmlns=""/>
<InnerException i:nil="true" xmlns=""/>
<HelpURL i:nil="true" xmlns=""/>
<StackTraceString i:nil="true" xmlns=""/>
<RemoteStackTraceString i:nil="true" xmlns=""/>
<RemoteStackIndex i:type="x:int" xmlns="">0</RemoteStackIndex>
<ExceptionMethod i:nil="true" xmlns=""/>
<HResult i:type="x:int" xmlns="">-2147467259</HResult>
<Source i:nil="true" xmlns=""/>
<WatsonBuckets i:nil="true" xmlns=""/>
</Win32Exception>
</detail>
</s:Fault>
我期待一个字符串数组作为响应,但我不断收到 Forbidden 并需要更多信息。我不知道我需要传递什么信息才能访问这些方法。 Windows 身份验证需要什么以及如何使用 PHP 实现它?
【问题讨论】:
标签: php wsdl soap-client dynamics-crm-365