PHP SOAPClient 使用 Windows 身份验证背后的 MS Dynamics WSDL 方法

萨迪姆 MK

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

我已经尝试过NTLMSoapClientNuSoap类,但是当它不抛出Forbidden消息时,它给了我空对象的 NULL 值,最终仍然没有从方法中得到响应。

我的代码与此类似

<?php 
$login = "[email protected]";
$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 实现它?

萨迪姆 MK

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

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

我没有使用 SOAPClient,而是使用 Curl 进入 Dynamics AX,因此我获得了授权并进入了。之后我遇到了另一个问题,您可以在这里找到它现在我面临一个不同的问题;似乎我能够使用我的授权令牌承载头,但我得到:

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

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

这是我的新错误的链接

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

在线使用MS Dynamics CRM 2016的REST Web API进行身份验证

使用集成Windows身份验证从HTTP服务器将WSDL导入soapUI

使用SOAP PHP对WSDL服务器进行身份验证

PHP使wsdl落后于摘要身份验证

PHP SoapClient是否以WSDL模式重映射SoapAction?

无法使用SoapClient PHP连接

如何使用指定Windows用户的Windows身份验证从ASP连接到MS SQL Server数据库

PHP SoapClient不适用于我的WebService。基本身份验证问题?

使用基本身份验证与摘要式身份验证与Windows身份验证的原因

php soapclient wsdl SOAP错误:解析WSDL:无法从中加载

PHP 无法使用 Edge 和 Windows 身份验证在 IIS 中写入文件

使用Windows身份验证的IIS PHP无法连接到SQL Server 2008R2

使用 Windows 身份验证的 REST API

使用PHP的Google身份验证失败

使用PHP进行LDAP身份验证

使用C#刷新MS Graph的身份验证令牌

避免使用NTLM身份验证方法

Laravel 身份验证使用 GET 方法

使用 Nginx 进行身份验证的方法

Dynamics 365身份验证

使用PHP SoapClient调用FreightQuote API

PHP 使用 SoapClient 耗尽内存大小

SignalR似乎正在使用Windows身份验证,而不是使用匿名身份验证

使用ClientID使用ADAL v3对Dynamics 365进行身份验证

使用HTTP身份验证和maven-jaxb2-plugin为WSDL生成模式

.NET Windows控制台通过php Web服务器进行身份验证并安全使用REST

使用 asp.net 中的基本身份验证覆盖 IIS Windows 身份验证

使用 Windows 集成身份验证对自定义 api 进行身份验证

无法使用Windows身份验证向SMTP服务器进行身份验证