HI i have used following code to read xml webresource in CMR but i am getting an Error like There is an error in XML document (1, 1480) while Reading XML from Webresource
Uri organizationuri = new Uri(".../XRMServices/2011/Organization.svc");
Uri homeRealmUri = null;
/*Live CRM*/
var deviceIDcreds = new ClientCredentials();
deviceIDcreds.UserName.UserName = "11pqlm4ldg5nqps9b4ivlngbfv";
deviceIDcreds.UserName.Password = "J-n60IBG7h;Ga`b5##SsDQhP";
/*Live CRM*/
var liveIDCreds = new ClientCredentials();
liveIDCreds.UserName.UserName = "username";
liveIDCreds.UserName.Password = "password";
_serviceProxy = new OrganizationServiceProxy(organizationuri, homeRealmUri, liveIDCreds, deviceIDcreds);
_service = (IOrganizationService)_serviceProxy;
orgContext = new OrganizationServiceContext(_serviceProxy);
TextWriter output=File.CreateText("C:\\perl.txt");
Uri organizationuri = new Uri("..../XRMServices/2011/Organization.svc");
SoapLoggerOrganizationService slos = new SoapLoggerOrganizationService(organizationuri, _service);
RetrieveMultipleRequest rmr = new RetrieveMultipleRequest();
RetrieveMultipleResponse resp = new RetrieveMultipleResponse();
WebResource wb = new WebResource();
QueryExpression query = new QueryExpression()
{
EntityName = "webresource",
ColumnSet = new ColumnSet("content"),
Criteria = new FilterExpression
{
FilterOperator = LogicalOperator.And,
Conditions =
{
new ConditionExpression
{
AttributeName = "webresourceid",
Operator = ConditionOperator.Equal,
Values = { "D161DA9A-B0A5-E211-97F2-D8D3855B15BD" }
}
}
}
};
rmr.Query = query;
resp = (RetrieveMultipleResponse)slos.Execute(rmr); //Getting an Error Here
wb = (WebResource)resp.EntityCollection.Entities[0];
byte[] b = Convert.FromBase64String(wb.Content);
//**************************************
//The string below will contain your HTML
//**************************************
string strHTML = System.Text.Encoding.UTF8.GetString(b);
and I am getting an Error in line resp = (RetrieveMultipleResponse)slos.Execute(rmr);
my XML file is like this
<root name="account">
<node cId="1ae50746-619c-e211-9b22-d8d3855b354e" cName="A. Datum Corporation (sample)" pId="00000000-0000-0000-0000-000000000000" pName="" />
<node cId="0ee50746-619c-e211-9b22-d8d3855b354e" cName="Adventure Works (sample)" pId="00000000-0000-0000-0000-000000000000" pName="" />
<node cId="18e50746-619c-e211-9b22-d8d3855b354e" cName="Alpine Ski House (sample)" pId="00000000-0000-0000-0000-000000000000" pName="" />
</root>