|
21.08.2009, 10:41 | #1 |
Консультант-джедай
|
пробуйте
var authenticationHeader = GenerateAuthenticationHeader(); // Prepare the SOAP message. var xml = "<?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'>"+ authenticationHeader+ "<soap:Body>"+ "<Fetch xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>"+ "<fetchXml><fetch mapping='logical'><entity name='equipment'><link-entity name='new_contractdetail_equipment' from='equipmentid' to='equipmentid'><filter type='and'><condition attribute='contractdetailid' operator='eq' value='"+crmForm.ObjectId+"'/></filter></link-entity></entity></fetch></fetchXml>"+ "</Fetch>"+ "</soap:Body>"+ "</soap:Envelope>"; // Prepare the xmlHttpObject and send the request. var xHReq = new ActiveXObject("Msxml2.XMLHTTP"); xHReq.Open("POST", "/mscrmservices/2007/CrmService.asmx", false); xHReq.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/Fetch"); xHReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); xHReq.setRequestHeader("Content-Length", xml.length); xHReq.send(xml); // Capture the result. var resultXml = xHReq.responseXML; // Check for errors. var errorCount = resultXml.selectNodes('//error').length; if (errorCount != 0) { var msg = resultXml.selectSingleNode('//description').nodeTypedValue; alert(msg); } // Process and display the results. else { // Capture the result and UnEncode it. var resultSet = new String(); resultSet = resultXml.text; resultSet.replace('<','<'); resultSet.replace('>','>'); // Create an XML document that you can parse. var oXmlDoc = new ActiveXObject("Microsoft.XMLDOM"); oXmlDoc.async = false; // Load the XML document that has the UnEncoded results. oXmlDoc.loadXML(resultSet); // Display the results. var results = oXmlDoc.getElementsByTagName('result'); var msg = "\Account Id\t\t\t\tAccount Name\r"; msg +="--------------------------------------------------------------------------------\r"; for (i=0;i < results.length;i++) { var idValue = results[i].selectSingleNode('./equipmentid').nodeTypedValue; msg += idValue +"\t"; } alert(msg); }
__________________
Крокодил, крокожу и буду крокодить. Человек человеку - волк , а зомби зомби - зомби. Экстремал и буду экстремать! Блога |
|
|
За это сообщение автора поблагодарили: Dekan (1). |
21.08.2009, 12:21 | #2 |
Участник
|
Работает slivka_83, очень большая благодарность вам!
|
|
Теги |
связанные сущности |
|
Опции темы | Поиск в этой теме |
Опции просмотра | |
|