从XRMServices/2011/Organization.svc获取标识符有问题


Issue getting identifier from XRMServices/2011/Organization.svc

我有一些代码类似于下面的Jason Lattimer的工作,但现在失败了。我可以在wsdl中找到"标识符"了。有人能提供帮助吗?

function GetADFS($url) {
    $ch = curl_init ();
    curl_setopt ( $ch, CURLOPT_URL, $url . "XrmServices/2011/Organization.svc?wsdl=wsdl0" );
    curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
    curl_setopt ( $ch, CURLOPT_TIMEOUT, 60 );
    curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, false );
    $response = curl_exec ( $ch );
    curl_close ( $ch );
    $responsedom = new DomDocument ();
    $responsedom->loadXML ( $response );
    // **************************************************       
    // **************************************************
    // Can no longer find this Identifier
    // **************************************************
    // **************************************************
    $identifiers = $responsedom->getElementsbyTagName ( "Identifier" );
    $identifier = $identifiers->item ( 0 )->textContent;
    return str_replace ( "http://", "https://", $identifier );
}

在命名空间'ms-xrm'中,所以替换

$identifiers = $responsedom->getElementsbyTagName ( "Identifier" );

$identifiers = $responsedom->getElementsbyTagNameNS ( "ms-xrm","Identifier" );

和检查。下一件事是检查实际的WSDL,如果你看到这个节点,如果没有,那么你的CRM配置可能有问题,因为该节点只有在你使用ADFS时才可用。