09.06.2010, 14:10 | #1 |
Участник
|
Ошибка выполнения запроса - система не находить запись
CRM 4.0
С помощью SOAP-запроса пытаюсь квалифицировать интерес. Делаю так: Код: var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); var soapXml = "<?xml version='1.0' encoding='utf-8'?>" + "<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' " + "xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' " + "xmlns:xsd='http://www.w3.org/2001/XMLSchema'>" + GenerateAuthenticationHeader() + "<soap:Body>" + "<Request xsi:type='SetStateLeadRequest' xmlns='http://schemas.microsoft.com/crm/2006/WebServices'>" + "<EntityId>" + leadId + "</EntityId>" + "<LeadState>Qualified</LeadState>" + "<LeadStatus>3</LeadStatus>" + "</Request>" + "</soap:Body>" + "</soap:Envelope>"; try { xmlhttp.open("POST", "/mscrmservices/2006/CrmService.asmx", false); xmlhttp.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2006/WebServices/Execute"); xmlhttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); xmlhttp.setRequestHeader("Content-Length", soapXml.length); xmlhttp.send(soapXml); var result = xmlhttp.responseXML.xml; if (result.indexOf('faultcode') < 0) crmForm.SubmitCrmForm(1,true,true,false); else alert(result); } catch(e) { alert(e.description); } Код: <?xml version='1.0' encoding='utf-8'?> <soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'> <soap:Header> <CrmAuthenticationToken xmlns="http://schemas.microsoft.com/crm/2007/WebServices"> <AuthenticationType xmlns="http://schemas.microsoft.com/crm/2007/CoreTypes">0</AuthenticationType> <CrmTicket xmlns="http://schemas.microsoft.com/crm/2007/CoreTypes"></CrmTicket> <OrganizationName xmlns="http://schemas.microsoft.com/crm/2007/CoreTypes">MyOrg</OrganizationName> <CallerId xmlns="http://schemas.microsoft.com/crm/2007/CoreTypes">00000000-0000-0000-0000-000000000000</CallerId> </CrmAuthenticationToken> </soap:Header> <soap:Body> <Request xsi:type='SetStateLeadRequest' xmlns='http://schemas.microsoft.com/crm/2006/WebServices'> <EntityId>{3ADEC8AB-466A-DF11-BE5B-00155D6F6500}</EntityId> <LeadState>Qualified</LeadState> <LeadStatus>3</LeadStatus> </Request> </soap:Body> </soap:Envelope> Код: <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <soap:Fault> <faultcode>soap:Server</faultcode> <faultstring>Server was unable to process request.</faultstring> <detail> <error> <code>0x80040217</code> <description>lead With Id = 3adec8ab-466a-df11-be5b-00155d6f6500 Does Not Exist</description> <type>Platform</type> </error> </detail> </soap:Fault> </soap:Body> </soap:Envelope> |
|