Hey,
ich have a problem with the authentication, when i connect to the ax2012 by webservices via http adapter. i would like to connect to ax2012 via php. i created a webservice under inbound ports successfully. the webservice is also working!
i try to connect via wsdl file to the webservice with the following php-code:
<?php
$arrOptions = array(
'soap_version' => SOAP_1_2,
'exceptions' => true,
'trace' => 1,
'cache_wsdl' => WSDL_CACHE_NONE,
'login' => 'Administrator',
'password' => 'pass@word1',
);
$strWSDl = 'http://ax2012-a.contoso.com:85/MicrosoftDynamicsAXAif60/SycAXCustomerServiceGroupHTTP/xppservice.svc?wsdl';
try {
$objClient = new SoapClient($strWSDl, $arrOptions);
echo '<h2>Available functions:</h2>';
var_dump($objClient->__getFunctions());
echo '<h2>Call methode (getCreditLimit):</h2>';
try {
var_dump($objClient->__soapCall("getCreditLimit", array('AccountNum' => 1101)));
} catch (SoapFault $arrSOAPFault) {
echo ('<p style="color:red;">SOAP Fault: <b>'.$arrSOAPFault->faultcode.' '.$arrSOAPFault->faultstring.'</b></p>');
}
} catch (Exception $objError) {
echo '<b>'.$objError->getMessage().'</b>';
}
?>
The connection with the webserivce seems to be working!
The output from the line "var_dump($objClient->__getFunctions());" works. it shows me the available functions, like "getCreditLimit".
So far so good...
Now, when i call the function getCreditLimit() by "$objClient->__soapCall("getCreditLimit", array('AccountNum' => 1101))" i get the following error:
SOAP Fault: "HTTP Unauthorized". HTTP is the error code, and Unauthorized is the error text.
I dont know, whats the problem!?
The webserice runs on iis, and basic authentication is enabled.
Can someone tell me whats the problem?
thanks...
Frank