Php “客户关系管理动态”;验证消息“0”的安全性时出错;
我正设法进入http://xxxxxxxxxxx/CRM2011/XRMServices/2011/Organization.svc?wsdl 我可以看到功能列表。意味着我可以访问webservice。但是,当我尝试使用函数create-it写入数据时,通过“验证消息安全性时出错”,我的代码如下Php “客户关系管理动态”;验证消息“0”的安全性时出错;,php,web-services,soap,dynamics-crm-2011,Php,Web Services,Soap,Dynamics Crm 2011,我正设法进入http://xxxxxxxxxxx/CRM2011/XRMServices/2011/Organization.svc?wsdl 我可以看到功能列表。意味着我可以访问webservice。但是,当我尝试使用函数create-it写入数据时,通过“验证消息安全性时出错”,我的代码如下 <?php date_default_timezone_set("Asia/Kolkata"); ini_set("soap.wsdl_cache_enabled", "0"); $loc
<?php
date_default_timezone_set("Asia/Kolkata");
ini_set("soap.wsdl_cache_enabled", "0");
$location = "http://182.18.175.29/CRM2011/XRMServices/2011/Organization.svc?wsdl";
$config['Username'] = 'xxxxxxx';
$config['Password'] = 'xxxxxx';
$config['soap_version'] = SOAP_1_2;
$config['trace'] = 1; // enable trace to view what is happening
$config['use'] = SOAP_LITERAL;
$config['style'] = SOAP_DOCUMENT;
$config['exceptions'] = 0; // disable exceptions
$config["cache_wsdl"] = WSDL_CACHE_NONE; // disable any caching on the wsdl, encase you alter the wsdl server
$config["features"] = SOAP_SINGLE_ELEMENT_ARRAYS;
include_once 'ntlmSoap.php';
$client = new NTLMSoapClient($location, $config);
print('<pre>');
print_r($client->__getFunctions());
$HeaderSecurity = array("UsernameToken" => array("Username" => 'xxxxxx', "Password" => 'xxxxxx'));
$header[] = new SoapHeader($location, "Security", $HeaderSecurity);
$client->__setSoapHeaders($header);
$params = array(
"bmw_firstname" => "test",
"bmw_lastname" => "test"
);
try {
$response = $client->__soapCall("Create", $params);
var_dump($response);
} catch (Exception $e) {
print_r($e);
}
// display what was sent to the server (the request)
echo "<p>Request :" . htmlspecialchars($client->__getLastRequest()) . "</p>";
// display the response from the server
echo "<p>Response:" . htmlspecialchars($client->__getLastResponse()) . "</p>";
我认为将您的实时IP地址放在公共论坛中不是一个好主意。您并不是真正访问Web服务-您只是请求不需要身份验证的Web服务描述。我没有从PHP访问OrganizationService的任何经验,但我会检查您的IIS是否配置为允许NTLM身份验证,我假设您正在使用NTLM身份验证。我已将您的IP地址匿名化。向公众共享IP地址是不安全的。我建议您不要与任何人共享您的ID地址。