I am trying to connect to a web service which requires a windows authentication.
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.
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.
My code is similar to this
<?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"
?>
Even when I use SOAPUI
I get the same result
<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?
So this problem got Solved by using the Dynamics integration Samples for phpApplication from this github account https://github.com/microsoft/Dynamics-AX-Integration
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
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 . 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.