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 = "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
<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?