Paul Rajs

Paul Rajs

  • NA
  • 641
  • 147.2k

How to get the full value of the Xml data uing c#

Sep 4 2020 1:30 AM
Hi Friends ,
I need to get all string in a xml format ...
xml string :
<TRMData><Data><CaseID>244186</CaseID><Category>Prepaid Card - Request</Category><CreatedDate>7/16/2020 7:46:26 AM</CreatedDate><CaseOwnerECN>86022</CaseOwnerECN><CaseStatus>In Progress</CaseStatus><<FinacleCustID>39284713</FinacleCustID><FinacleMobileNumber>9782898979</FinacleMobileNumber></Data><TRMData>
now getting output : TRMData="244186"
Expecting Output = TRMData=
<Data><CaseID>244186</CaseID><Category>Prepaid Card - Request</Category><CreatedDate>7/16/2020 7:46:26 AM</CreatedDate><CaseOwnerECN>86022</CaseOwnerECN><CaseStatus>In Progress</CaseStatus><<FinacleCustID>39284713</FinacleCustID><FinacleMobileNumber>9782898979</FinacleMobileNumber></Data>
class properties :
public class TRMProperties
{
[XmlRoot(ElementName = "Request")]
public class TRMFileUpdationRequest
{
[XmlElement(ElementName = "Filename")]
public string Filename { get; set; }
[XmlElement(ElementName = "TRMData")]
public string TRMData { get; set; }
}
}
Web service file method
[WebMethod()]
public string TRMFileUpdation(string RequestData)
{
XmlDocument xmldoc = new XmlDocument();
string lstrReturn = "";
StringBuilder lstrXmlString = new StringBuilder();
Models.TRM.TRMProperties.TRMFileUpdationRequest objRequest = new Models.TRM.TRMProperties.TRMFileUpdationRequest();
try
{
clsErrorLog.WriteAppLogFiles(RequestData, DateTime.Now, "TRMFileUpdation", mstrMethods, GetDeviceInfo());
RequestData = clsCommonCryptography.StringDecrypt(RequestData);
using (TextReader sr = new StringReader(RequestData))
{
var serializer = new System.Xml.Serialization.XmlSerializer(typeof(ETC_WebService.Models.TRM.TRMProperties.TRMFileUpdationRequest));
objRequest = (ETC_WebService.Models.TRM.TRMProperties.TRMFileUpdationRequest)serializer.Deserialize(sr);
}
lstrReturn = mobjIMPS.TRMFileUpdation(objRequest);
lstrReturn = clsCommonCryptography.StringEncrypt(lstrReturn);
return lstrReturn;
}
catch (Exception ex)
{
clsErrorLog.WriteErrLogFiles(RequestData, "TRMFileUpdation", mstrMethods, GetDeviceInfo(), 0, ex);
lstrReturn = ETC_WebService.Models.Helper.clsGeneral.XMLStatus("Response", "017", "Please try again");
lstrReturn = clsCommonCryptography.StringEncrypt(lstrReturn);
return lstrReturn;
}
}
Request Data :
<TRMData><Data><CaseID>244186</CaseID><Category>Prepaid Card - Request</Category><SubCategory>NETC Fastag</SubCategory><CaseType>Request</CaseType><CreatedDate>7/16/2020 7:46:26 AM</CreatedDate><CaseOwnerECN>86022</CaseOwnerECN><CaseStatus>In Progress</CaseStatus><<FinacleCustID>39284713</FinacleCustID><FinacleMobileNumber>9782898979</FinacleMobileNumber></Data><TRMData>
Kindly suggest me to i solve this solution
Thanks & regards
Paul.S

Answers (1)