【问题标题】:PHP SOAPClient consuming MS Dynamics WSDL Methods behind Windows AuthenticationPHP SOAPClient 在 Windows 身份验证后使用 MS Dynamics WSDL 方法
【发布时间】:2019-07-25 12:01:24
【问题描述】:

我正在尝试连接到需要 Windows 身份验证的 Web 服务。 我正在用 PHP 编写代码并尝试调用 MS dynamics 365 wsdl 的方法 但我得到的只是Forbidden608 error code: There is insufficient account information to log you on.

我尝试了NTLMSoapClientNuSoap 类,但是当它没有抛出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


    【解决方案1】:

    所以这个问题通过使用来自这个 github 帐户 https://github.com/microsoft/Dynamics-AX-Integration 的 phpApplication 的动态集成示例得到解决

    在阅读了here 中的 Microsoft 文档后,我了解到它需要从 azure AD 获取授权令牌,并且该令牌需要作为 Authorization: Bearer tokenString 添加到我的 curl 标头中

    我没有使用 SOAPClient,而是使用 Curl 进入 Dynamics AX 在这样做的过程中,我获得了授权并进入。之后我遇到了一个问题 you can find it here 。现在我面临一个不同的问题;看来我可以使用我的授权令牌承载标头,但我得到了:

    Forbidden 1317 System.ComponentModel.Win32Exception The specified account does not exist
    

    我为此创建了一个不同的帖子,以防万一我解决它,我会发布我的答案,或者如果有人已经解决它..请告诉我。

    Here is the link to the my new Error

    【讨论】:

      猜你喜欢
      • 2013-11-27
      • 2012-03-29
      • 2023-03-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-09
      • 1970-01-01
      • 2017-07-01
      相关资源
      最近更新 更多