We did upgrade CRM 2011 to CRM 2015 and now we have a old SOAP that does not work in CRM 2015.
Could someone help me out with it?
Here is the code:
function GetProdText() {
var lookup = new Array();
lookup = Xrm.Page.getAttribute("productid").getValue();
var prodid = lookup[0].id;
// alert(prodid);
// Prepare the SOAP message.
var authenticationHeader = GenerateAuthenticationHeader();
var xml = "<?xml version='1.0' encoding='utf-8'?>" +
"<soap:Envelope xmlns:soap='schemas.xmlsoap.org/.../envelope'" +
" xmlns:xsi='www.w3.org/.../XMLSchema-instance'" +
" xmlns:xsd='www.w3.org/.../XMLSchema'>" +
authenticationHeader +
"<soap:Body>" +
"<Retrieve xmlns='schemas.microsoft.com/.../WebServices'>" +
"<entityName>product</entityName>" +
"<id>" + prodid + "</id>" +
"<columnSet xmlns:q1='schemas.microsoft.com/.../Query' xsi:type='q1:ColumnSet'>" +
"<q1:Attributes>" +
"<q1:Attribute>description</q1:Attribute>" + //add more fields that you want to fetch
"</q1:Attributes>" +
"</columnSet>" +
"</Retrieve>" +
"</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", "schemas.microsoft.com/.../Retrieve");
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);
}
// Display the retrieved value.
else
{
Xrm.Page.getAttribute("description").setValue(resultXml.selectSingleNode("//q1:description").nodeTypedValue);
}
}
Maybe build a Rest or oData?
Thank you and best regards,
Dennis