web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Connect with PHP to Webservice via HTTP Adapter

(0) ShareShare
ReportReport
Posted on by 30

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

*This post is locked for comments

I have the same question (0)
  • ECNCC Profile Picture
    25 on at

    Hi Frank,

    We are running into the same issue, were you ever able to figure this out?

    Thanks,

    -Andreas

  • Esther Mulijono Profile Picture
    435 on at

    Hi,

    Have anyone find any solution for this problem?

    Regards,

    Esther

  • Suggested answer
    Martin Dráb Profile Picture
    237,874 Most Valuable Professional on at

    It's several years since the question was asked, nevertheless if it's been reopened by Esther...

    Please read How to implement basic authentication with Dynamics Ax 2012 web services - it explains how to configure the service and how to provide credentials from .NET; you'll just have to do something similar in PHP.

  • Esther Mulijono Profile Picture
    435 on at

    Hi Martin,

    Thank you very much.

    Regards,

    Esther

  • Community Member Profile Picture
    on at

    There is solutions. 
    stackoverflow.com/.../call-webservice-with-ntlm-authorization

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans