Answered by:
Update from CRM2011 to CRM2013

Question
-
Hi, In the follow code, I have the error
"Web resource XXXX contains a reference to the 2007 web service endpoint"
during the migration to CRM2013
_Winvs.Common = { ExecuteRetrieveRequest: function (EntityName, EntityId, EntityColumns) { var resultXml, errorCount, msg, xmlHttpRequest, arrayEntityColumns, xmlEntityColumns; if (EntityColumns != undefined) { arrayEntityColumns = EntityColumns.split(","); for (var i = 0; i < arrayEntityColumns.length; i++) { xmlEntityColumns += "<q1:Attribute>" + arrayEntityColumns[i] + "</q1:Attribute>"; } } var authenticationHeader = _Winvs.Context.AuthenticationHeader; // 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>" + "<Retrieve xmlns='http://schemas.microsoft.com/crm/2011/WebServices'>" + "<entityName>" + EntityName + "</entityName>" + "<id>" + EntityId + "</id>" + "<columnSet xmlns:q1='http://schemas.microsoft.com/crm/2006/Query' xsi:type='q1:ColumnSet'>"; if (_Winvs.Helpers.HasStringValue(xmlEntityColumns)) { xml = xml + "<q1:Attributes>" + xmlEntityColumns + "</q1:Attributes>"; } else { xml = xml + "<q1:AllColumns>true</q1:AllColumns>"; } xml = xml + "</columnSet>" + "</Retrieve></soap:Body></soap:Envelope>"; // create Request xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP"); xmlHttpRequest.Open("POST", "/mscrmservices/2011/CrmService.asmx", false); xmlHttpRequest.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2011/WebServices/Retrieve"); xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); xmlHttpRequest.setRequestHeader("Content-Length", xml.length); xmlHttpRequest.send(xml); // get Response resultXml = xmlHttpRequest.responseXML; var errorCount = resultXml.selectNodes('//error').length; if (errorCount != 0) { var msg = _Winvs.Helpers.ReadXmlNodeValue('description'); alert("Error Message : " + msg); } else { return resultXml; } }
Can you help me?
Alessandro Graps
Monday, July 21, 2014 10:00 AM
Answers
-
Hi Alessandro,
Since you're using the 2007 web references (introduced in CRM 4.0 and compatible till CRM 2011), the code needs to be re-written using the 2011 REST API.
Have a look at the following link to see how you can use the OData (REST API) of CRM 2013 to carry out a Retrieve Request: http://msdn.microsoft.com/en-in/library/gg334427.aspx
You can also download the OData Query Designer which will help you in forming the Odata Query.
Admin QuikView Solution for CRM 2013
- Edited by Anupam Bishui Monday, July 21, 2014 10:27 AM
- Marked as answer by [MVP] Alessandro Graps Thursday, July 24, 2014 12:06 PM
Monday, July 21, 2014 10:26 AM
All replies
-
Hi Alessandro,
Since you're using the 2007 web references (introduced in CRM 4.0 and compatible till CRM 2011), the code needs to be re-written using the 2011 REST API.
Have a look at the following link to see how you can use the OData (REST API) of CRM 2013 to carry out a Retrieve Request: http://msdn.microsoft.com/en-in/library/gg334427.aspx
You can also download the OData Query Designer which will help you in forming the Odata Query.
Admin QuikView Solution for CRM 2013
- Edited by Anupam Bishui Monday, July 21, 2014 10:27 AM
- Marked as answer by [MVP] Alessandro Graps Thursday, July 24, 2014 12:06 PM
Monday, July 21, 2014 10:26 AM -
thanks for your help...
I am trying this way...
Alessandro Graps
Thursday, July 24, 2014 12:06 PM