Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<pre><code>require_once ('/var/mtp/lib/vendor/nusoap/lib/nusoap.php'); $login ='domain\username'; $pass ='password'; $useCURL = true; $client = new nusoap_client('http://server:5555/mscrmservices/2006/crmservice.asmx?wsdl', 'wsdl'); $client-&gt;setCredentials($login, $pass, 'ntlm'); $client-&gt;setUseCurl($useCURL); $client-&gt;useHTTPPersistentConnection(); $client-&gt;soap_defencoding = 'UTF-8'; $err = $client-&gt;getError(); if ($err) { echo '&lt;h2&gt;Constructor error&lt;/h2&gt;&lt;pre&gt;' . $err . '&lt;/pre&gt;'; echo '&lt;h2&gt;Debug&lt;/h2&gt;&lt;pre&gt;' . htmlspecialchars($client-&gt;getDebug(), ENT_QUOTES) . '&lt;/pre&gt;'; exit(); } $soapHeader='&lt;soap:Header&gt;' . '&lt;CallerId xmlns="http://schemas.microsoft.com/crm/2006/WebServices"&gt;'. '&lt;CallerGuid xmlns="http://schemas.microsoft.com/crm/2006/CoreTypes"&gt;00000000-0000-0000-0000-000000000000&lt;/CallerGuid&gt;&lt;/CallerId&gt;' . '&lt;/soap:Header&gt;'; $soapBody='&lt;soap:Body&gt;' . '&lt;entity xmlns="http://schemas.microsoft.com/crm/2006/WebServices" xsi:type="lead"&gt;' . '&lt;ownerid type="Owner"&gt;2408c7dc-c0a3-dd11-b3cd-001a4bd3009a&lt;/ownerid&gt;' . '&lt;firstname&gt;Fred&lt;/firstname&gt;' . '&lt;lastname&gt;Bloggs&lt;/lastname&gt;' . '&lt;/entity&gt;' . '&lt;/soap:Body&gt;'; $xml = '&lt;?xml version="1.0" encoding="utf-8"?&gt;' . '&lt;soap:Envelope' . ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . ' xmlns:xsd="http://www.w3.org/2001/XMLSchema"' . ' xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;' . $soapHeader . $soapBody . '&lt;/soap:Envelope&gt;'; //SOAP call $result = $client-&gt;send($xml,'http://schemas.microsoft.com/crm/2006/WebServices/Create' ); //result if ($client-&gt;fault) { //check for fault echo '&lt;p&gt;&lt;b&gt;Fault: '; print_r($result); echo '&lt;/b&gt;&lt;/p&gt;'; } else { //no fault $err = $client-&gt;getError(); if ($err) { // error echo 'Error: ' . $err . ''; echo "\n\n# # # # # # # Request # # # # # # #\n"; var_dump($client-&gt;request); echo "\n\n# # # # # # Response # # # # # # #\n"; var_dump($client-&gt;response); } else { // display the result print_r($result); } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload