[英]PHP SOAPClient consuming MS Dynamics WSDL Methods behind Windows Authentication
I am trying to connect to a web service which requires a windows authentication. 我正在尝试连接到需要Windows身份验证的Web服务。 I am writing a code in PHP and trying to call methods of
MS dynamics 365 wsdl
but all I get is Forbidden
and 608 error code: There is insufficient account information to log you on.
我正在用PHP编写代码,并尝试调用
MS dynamics 365 wsdl
方法,但我得到的只是“ Forbidden
和608 error code: There is insufficient account information to log you on.
I have tried the NTLMSoapClient
and NuSoap
classes, but when it doesn't throw a Forbidden
message, it gives me NULL values of empty objects, which in the end still not getting the response from the method. 我已经尝试了
NTLMSoapClient
和NuSoap
类,但是当它没有抛出Forbidden
消息时,它为我提供了空对象的NULL值,但最终仍然无法从该方法获得响应。
My code is similar to this 我的代码与此类似
<?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"
?>
Even when I use SOAPUI
I get the same result 即使使用
SOAPUI
我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>
I am expecting an array of strings as a response but I keep getting Forbidden and need more information. 我期望一个字符串数组作为响应,但是我一直在被禁止,并且需要更多信息。 I don't know what information I need to pass to access the methods.
我不知道访问这些方法需要传递什么信息。 What does Windows authentication need and how can I implement it using PHP?
Windows身份验证需要什么?如何使用PHP实施它?
So this problem got Solved by using the Dynamics integration Samples for phpApplication from this github account https://github.com/microsoft/Dynamics-AX-Integration 因此,通过使用此github帐户https://github.com/microsoft/Dynamics-AX-Integration的 phpApplication动态集成示例解决了此问题
And after reading Microsoft documents in here I understood it needed to get an authorization token from azure AD and that token needs to be added in my curl header as Authorization: Bearer tokenString 在这里阅读Microsoft文档之后,我了解到它需要从azure AD获取授权令牌,并且需要在我的curl头中将令牌添加为Authorization:Bearer tokenString
instead of using SOAPClient I am using Curl to get into Dynamics AX in doing so I got authorized and got in. I faced anotehr issue afterwards you can find it here . 我不是使用SOAPClient,而是使用Curl进入Dynamics AX,因此我获得了授权并加入了。之后,我遇到了anotehr问题, 您可以在这里找到它 。 And now I am facing a different issue;
现在,我面临着另一个问题。 It seems I was able to get in with my Authorization Token Bearer Header, but I am getting:
看来我能够使用我的授权令牌承载标头,但是却得到了:
Forbidden 1317 System.ComponentModel.Win32Exception The specified account does not exist
Which I created a different post for in case I solve it I will post my answer or if anyone already solved it .. please let me know. 我创建了一个不同的帖子,如果我解决了,我会发布我的答案,或者如果有人已经解决了..请告诉我。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.