我有一個簡單的PHP腳本,其中包含SOAP調用我的CRM Online。我可以創建和檢索記錄,但是我在設置實體客戶時遇到問題。我的一個SOAP調用是這樣的;它會創建記錄但不會設置客戶。從php到CRMOneline的SOAP請求
$liveIDManager = new LiveIDManager();
$securityData = $liveIDManager->authenticateWithLiveID($organizationServiceURL, $liveIDUseranme, $liveIDPassword);
if($securityData!=null && isset($securityData)){
//echo ("\nKey Identifier:" . $securityData->getKeyIdentifier());
//echo ("\nSecurity Token 1:" . $securityData->getSecurityToken0());
//echo ("\nSecurity Token 2:" . $securityData->getSecurityToken1());
}else{
echo "Unable to authenticate LiveId.";
return;
}
echo "\n";
$domainname = substr($CRMURL,8,-1);
$pos = strpos($domainname, "/");
$domainname = substr($domainname,0,$pos);
print_r($data);
$contactRequest = EntityUtils::getCreateCRMSoapHeader($CRMURL, $securityData).
<s:Body>
<Create xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services">
<entity xmlns:b="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<b:Attributes xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
<b:KeyValuePairOfstringanyType>
<c:key>firstname</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">'.$data['Account']['name'].'</c:value>
<c:key>parentcustomerid</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">'.$data['Account']['id'].'</c:value>
</b:KeyValuePairOfstringanyType>
</b:Attributes>
<b:EntityState i:nil="true"/>
<b:FormattedValues xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic"/>
<b:Id>00000000-0000-0000-0000-000000000000</b:Id>
<b:LogicalName>contact</b:LogicalName>
<b:RelatedEntities xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic"/>
</entity>
</Create>
</s:Body>
$response = LiveIDManager::GetSOAPResponse("/Organization.svc", $domainname, $CRMURL, $accountsRequest);
echo $response;
$createResult ="";
if($response!=null && $response!=""){
preg_match('/<CreateResult>(.*)<\/CreateResult>/', $response, $matches);
$createResult = $matches[1];
}
有沒有人通過這個和/或知道我失蹤了?
謝謝, 布拉德