Authenticating by using SOAP requests RRS feed

  • Question

  • Please can someone advise how I may go about authenticating with my client's by using raw SOAP requests. I have made the connection to the server and am posting a skeleton SOAP envelope, which of course gives me the following response:

    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">



    <faultcode xmlns:a="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">a:FailedAuthentication</faultcode>

    <faultstring xml:lang="en-GB">Access is denied.</faultstring>




    I have been told that I should be using Active Directory Authentication but am unsure whether this applies at the SOAP stage. Certainly, the credentials I was given allowed me to authenticate at the HTTP stage, but am not sure of the protocol when I start talking to the CRM.

    Thursday, October 23, 2014 4:00 PM

All replies

  • Hi Ashley,

    please post your code.



    Thursday, October 23, 2014 8:01 PM
  • Thanks Jithesh

    Here is the code. Btw this is an IFD install of Dynamics CRM 2013.

    $SOAPEnv = <<<ENV
    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    $headers = array(
      'Method: POST',
      'Connection: Keep-Alive',
      'User-Agent: PHP-SOAP-CURL',
      'Content-Type: text/xml',
      "SOAPAction: http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Execute",  
    $url = 'http://the.site.com/XRMServices/2011/Organization.svc/web';
    $username  = 'myusername';
    $password  = 'mypassword';
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
    curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $SOAPEnv);
    $output = curl_exec($ch);

    Friday, October 24, 2014 8:19 AM