Tuesday, February 27, 2007

XML String, Dataset and Class Manipulation

I have written some useful ready to use functions in a Helper Class which can be used in XML string manipulation. These functions include following abilities :

1. Get XML data string from/to a class
2. Set/Remove CDATA in XML String
3. Clear All/Limited Special Characters from XML string
4. Set/Remove Root Node to XML String
5. Get Inner XML/Text on Relative Path
6. Get XML Document to/from an object
7. Get Custom Dataset from/to XML string

This Class project contains two classes. First class defines a class structure and second class uses this class for several functions.

Class : Helper

Code Snippet
  1. Option Explicit On
  2. Option Strict On
  3. Imports System.Xml.Serialization
  4. Imports System.IO
  5. Imports System.Text
  6. Imports System.Xml
  7. Imports System.Data
  8. ' ' The helper Class Transaction helper. This
  9. ' also includes the Exception class.
  10. ' ================================
  11. ' Version History:
  12. ' Date Version Author Remarks
  13. ' 02/27/2007 1.0 Vishwa Provides function to parse XML transaction
  14. ' ===================================
  15. Public NotInheritable Class Helper
  16. #Region "Private Constructor"
  17. Private Sub New()
  18. End Sub
  19. #End Region
  20. Public Shared Function GetTransaction(ByVal strXML As String) As MyTransaction
  21. Dim xdcXML As New XmlDocument
  22. Dim xndXML As XmlNode
  23. Dim objMyTranasction As New MyTransaction
  24. Try
  25. strXML = ClearLimitedSpecialCharFromXML(strXML)
  26. xdcXML.LoadXml(strXML)
  27. If xdcXML.DocumentElement.Name = "MY_TRANSACTION" Then
  28. If Not xdcXML.DocumentElement("LOGIN") Is Nothing Then
  29. xndXML = xdcXML.DocumentElement("LOGIN")
  30. If Not xndXML.SelectSingleNode("TOKEN_ID") Is Nothing Then
  31. objMyTranasction.TokenID = xndXML.SelectSingleNode("TOKEN_ID").InnerText()
  32. End If
  33. If Not xndXML.SelectSingleNode("USER_ID") Is Nothing Then
  34. objMyTranasction.UserID = xndXML.SelectSingleNode("USER_ID").InnerText()
  35. End If
  36. If Not xndXML.SelectSingleNode("USER_PASSWORD") Is Nothing Then
  37. objMyTranasction.UserPassword = xndXML.SelectSingleNode("USER_PASSWORD").InnerText()
  38. End If
  39. If Not xndXML.SelectSingleNode("IP_ADDRESS") Is Nothing Then
  40. objMyTranasction.IPAddress = xndXML.SelectSingleNode("IP_ADDRESS").InnerText()
  41. End If
  42. If Not xdcXML.DocumentElement("TRANSACTION") Is Nothing Then
  43. xndXML = xdcXML.DocumentElement("TRANSACTION")
  44. If Not xndXML.SelectSingleNode("TRANSACTION_REFID") Is Nothing Then
  45. objMyTranasction.TransactionRefID = xndXML.SelectSingleNode("TRANSACTION_REFID").InnerText
  46. End If
  47. If Not xndXML.SelectSingleNode("TRANSACTION_ID") Is Nothing Then
  48. If IsNumeric(xndXML.SelectSingleNode("TRANSACTION_ID").InnerText) And _
  49. xndXML.SelectSingleNode("TRANSACTION_ID").InnerText.Trim.Length > 0 Then
  50. objMyTranasction.TransactionID = CInt(xndXML.SelectSingleNode("TRANSACTION_ID").InnerText)
  51. End If
  52. End If
  53. If Not xndXML.SelectSingleNode("TRANSACTION_REQUEST_DATE") Is Nothing Then
  54. If IsDate(xndXML.SelectSingleNode("TRANSACTION_REQUEST_DATE").InnerText) And _
  55. xndXML.SelectSingleNode("TRANSACTION_REQUEST_DATE").InnerText.Trim.Length > 0 Then
  56. objMyTranasction.TransactionRequestDate = _
  57. CDate(xndXML.SelectSingleNode("TRANSACTION_REQUEST_DATE").InnerText)
  58. End If
  59. If DateDiff(DateInterval.Day, objMyTranasction.TransactionRequestDate, Date.Today) <> 0 Then _
  60. objMyTranasction.TransactionRequestDate = DateAndTime.Now
  61. Else
  62. objMyTranasction.TransactionRequestDate = DateAndTime.Now
  63. End If
  64. If Not xndXML.SelectSingleNode("TRANSACTION_RESPONSE_DATE") Is Nothing Then
  65. If IsDate(xndXML.SelectSingleNode("TRANSACTION_RESPONSE_DATE").InnerText) And _
  66. xndXML.SelectSingleNode("TRANSACTION_RESPONSE_DATE").InnerText.Trim.Length > 0 Then
  67. objMyTranasction.TransactionResponseDate = _
  68. CDate(xndXML.SelectSingleNode("TRANSACTION_RESPONSE_DATE").InnerText)
  69. End If
  70. If DateDiff(DateInterval.Day, objMyTranasction.TransactionResponseDate, Date.Today) <> 0 Then _
  71. objMyTranasction.TransactionResponseDate = DateAndTime.Now
  72. End If
  73. If Not xndXML.SelectSingleNode("TRANSACTION_NAME") Is Nothing Then
  74. objMyTranasction.WebMethodName = xndXML.SelectSingleNode("TRANSACTION_NAME").InnerText()
  75. End If
  76. If Not xndXML.SelectSingleNode("TRANSACTION_PARAMETERS") Is Nothing Then
  77. objMyTranasction.WebMethodXML = xndXML.SelectSingleNode("TRANSACTION_PARAMETERS").InnerXml()
  78. End If
  79. If Not xndXML.SelectSingleNode("TRANSACTION_DATA") Is Nothing Then
  80. objMyTranasction.WebMethodXMLData = xndXML.SelectSingleNode("TRANSACTION_DATA").InnerXml()
  81. End If
  82. If Not xndXML.SelectSingleNode("TRANSACTION_MESSAGE") Is Nothing Then
  83. xndXML = xndXML.SelectSingleNode("TRANSACTION_MESSAGE")
  84. If Not xndXML.SelectSingleNode("MESSAGE_NO") Is Nothing Then
  85. If IsNumeric(xndXML.SelectSingleNode("MESSAGE_NO").InnerText) And _
  86. xndXML.SelectSingleNode("MESSAGE_NO").InnerText.Trim.Length > 0 Then
  87. objMyTranasction.MessageNumber = CInt(xndXML.SelectSingleNode("MESSAGE_NO").InnerText)
  88. End If
  89. End If
  90. If Not xndXML.SelectSingleNode("MESSAGE_MODULE") Is Nothing Then
  91. objMyTranasction.MessageModule = xndXML.SelectSingleNode("MESSAGE_MODULE").InnerText
  92. End If
  93. If Not xndXML.SelectSingleNode("MESSAGE_DETAIL") Is Nothing Then
  94. objMyTranasction.MessageDetail = xndXML.SelectSingleNode("MESSAGE_DETAIL").InnerText
  95. End If
  96. End If
  97. If objMyTranasction.TransactionRequestXML.Trim.Length = 0 Then _
  98. objMyTranasction.TransactionRequestXML = strXML
  99. End If
  100. End If
  101. End If
  102. Return objMyTranasction
  103. Catch exc As Exception
  104. Throw New Exception(exc.Message)
  105. Return objMyTranasction
  106. End Try
  107. End Function
  108. Public Shared Function PrepareTransactionXML(ByVal objMyTransaction As MyTransaction) As String
  109. Dim xdcXMLDoc As New XmlDocument
  110. Dim xndNode As XmlNode
  111. Dim xndChildNode As XmlNode
  112. Dim xndParentNode As XmlNode
  113. Dim xcdCData As XmlCDataSection
  114. Dim xdeDeclare As XmlDeclaration
  115. Try
  116. xdeDeclare = xdcXMLDoc.CreateXmlDeclaration("1.0", Nothing, Nothing)
  117. xndNode = xdcXMLDoc.CreateNode(XmlNodeType.Element, "MY_TRANSACTION", "")
  118. xdcXMLDoc.AppendChild(xndNode)
  119. xdcXMLDoc.InsertBefore(xdeDeclare, xndNode)
  120. xndChildNode = xdcXMLDoc.CreateNode(XmlNodeType.Element, "LOGIN", "")
  121. xndNode.AppendChild(xndChildNode)
  122. xndParentNode = xndChildNode
  123. xndChildNode = xdcXMLDoc.CreateNode(XmlNodeType.Element, "TOKEN_ID", "")
  124. xndChildNode.InnerText = objMyTransaction.TokenID
  125. xndParentNode.AppendChild(xndChildNode)
  126. xndChildNode = xdcXMLDoc.CreateNode(XmlNodeType.Element, "USER_ID", "")
  127. xndChildNode.InnerText = objMyTransaction.UserID
  128. xndParentNode.AppendChild(xndChildNode)
  129. xndChildNode = xdcXMLDoc.CreateNode(XmlNodeType.Element, "USER_PASSWORD", "")
  130. xndChildNode.InnerText = objMyTransaction.UserPassword
  131. xndParentNode.AppendChild(xndChildNode)
  132. xndChildNode = xdcXMLDoc.CreateNode(XmlNodeType.Element, "IP_ADDRESS", "")
  133. xndChildNode.InnerText = objMyTransaction.IPAddress
  134. xndParentNode.AppendChild(xndChildNode)
  135. xndChildNode = xdcXMLDoc.CreateNode(XmlNodeType.Element, "TRANSACTION", "")
  136. xndNode.AppendChild(xndChildNode)
  137. xndParentNode = xndChildNode
  138. xndChildNode = xdcXMLDoc.CreateNode(XmlNodeType.Element, "TRANSACTION_REFID", "")
  139. xndChildNode.InnerText = objMyTransaction.TransactionRefID
  140. xndParentNode.AppendChild(xndChildNode)
  141. xndChildNode = xdcXMLDoc.CreateNode(XmlNodeType.Element, "TRANSACTION_ID", "")
  142. xndChildNode.InnerText = objMyTransaction.TransactionID.ToString
  143. xndParentNode.AppendChild(xndChildNode)
  144. xndChildNode = xdcXMLDoc.CreateNode(XmlNodeType.Element, "TRANSACTION_REQUEST_DATE", "")
  145. xndChildNode.InnerText = objMyTransaction.TransactionRequestDate.ToString
  146. xndParentNode.AppendChild(xndChildNode)
  147. xndChildNode = xdcXMLDoc.CreateNode(XmlNodeType.Element, "TRANSACTION_RESPONSE_DATE", "")
  148. xndChildNode.InnerText = objMyTransaction.TransactionResponseDate.ToString 'DateTime.Now.ToString
  149. xndParentNode.AppendChild(xndChildNode)
  150. If objMyTransaction.WebMethodName.Trim.Length = 0 Then _
  151. objMyTransaction.WebMethodName = "TRANSACTION_METHOD_UNKNOWN"
  152. xndChildNode = xdcXMLDoc.CreateNode(XmlNodeType.Element, "TRANSACTION_NAME", "")
  153. xndChildNode.InnerText = objMyTransaction.WebMethodName
  154. xndParentNode.AppendChild(xndChildNode)
  155. xndChildNode = xdcXMLDoc.CreateNode(XmlNodeType.Element, "TRANSACTION_PARAMETERS", "")
  156. If objMyTransaction.WebMethodXML.Trim.Length > 0 And _
  157. ValidateXMLString(objMyTransaction.WebMethodXML) Then
  158. xndChildNode.InnerText = objMyTransaction.WebMethodXML
  159. xndParentNode.AppendChild(xndChildNode)
  160. Else
  161. xndParentNode.AppendChild(xndChildNode)
  162. xcdCData = xdcXMLDoc.CreateCDataSection(objMyTransaction.WebMethodXML)
  163. xndChildNode.AppendChild(xcdCData)
  164. End If
  165. xndChildNode = xdcXMLDoc.CreateNode(XmlNodeType.Element, "TRANSACTION_DATA", "")
  166. If objMyTransaction.WebMethodXMLData.Trim.Length > 0 And _
  167. ValidateXMLString(objMyTransaction.WebMethodXMLData) Then
  168. xndChildNode.InnerText = ClearAllSpecialCharFromXML(objMyTransaction.WebMethodXMLData)
  169. xndParentNode.AppendChild(xndChildNode)
  170. Else
  171. xndParentNode.AppendChild(xndChildNode)
  172. xcdCData = xdcXMLDoc.CreateCDataSection(objMyTransaction.WebMethodXMLData)
  173. xndChildNode.AppendChild(xcdCData)
  174. End If
  175. If objMyTransaction.MessageNumber > 0 Then
  176. xndChildNode = xdcXMLDoc.CreateNode(XmlNodeType.Element, "TRANSACTION_MESSAGE", "")
  177. xndParentNode.AppendChild(xndChildNode)
  178. xndParentNode = xndChildNode
  179. xndChildNode = xdcXMLDoc.CreateNode(XmlNodeType.Element, "MESSAGE_NO", "")
  180. xndChildNode.InnerText = objMyTransaction.MessageNumber.ToString
  181. xndParentNode.AppendChild(xndChildNode)
  182. xndChildNode = xdcXMLDoc.CreateNode(XmlNodeType.Element, "MESSAGE_MODULE", "")
  183. xndChildNode.InnerText = objMyTransaction.MessageModule
  184. xndParentNode.AppendChild(xndChildNode)
  185. xndChildNode = xdcXMLDoc.CreateNode(XmlNodeType.Element, "MESSAGE_DETAIL", "")
  186. If objMyTransaction.MessageDetail.Trim.Length > 0 And ValidateXMLString(objMyTransaction.MessageDetail) Then
  187. xndChildNode.InnerText = ClearAllSpecialCharFromXML(objMyTransaction.MessageDetail)
  188. xndParentNode.AppendChild(xndChildNode)
  189. Else
  190. xndParentNode.AppendChild(xndChildNode)
  191. xcdCData = xdcXMLDoc.CreateCDataSection(objMyTransaction.MessageDetail)
  192. xndChildNode.AppendChild(xcdCData)
  193. End If
  194. End If
  195. Return ClearLimitedSpecialCharFromXML(xdcXMLDoc.OuterXml)
  196. Catch exc As Exception
  197. Throw New Exception(exc.Message)
  198. Finally
  199. xdcXMLDoc = Nothing
  200. End Try
  201. End Function
  202. Public Shared Function SetTransactionErrorMessage(ByVal objTransaction As MyTransaction, ByVal objError As ErrObject, ByVal objExc As Exception) As MyTransaction
  203. objTransaction.MessageNumber = objError.Number
  204. objTransaction.MessageModule = objExc.Source
  205. objTransaction.MessageDetail = objExc.ToString
  206. Return objTransaction
  207. End Function
  208. Public Shared Function ValidateXMLString(ByVal strXML As String) As Boolean
  209. Dim xdcXML As New XmlDocument
  210. Dim blnReturn As Boolean = False
  211. Try
  212. strXML = SetRootNodeToXML(strXML)
  213. xdcXML.LoadXml(strXML)
  214. blnReturn = True
  215. Catch
  216. blnReturn = False
  217. Finally
  218. ValidateXMLString = blnReturn
  219. End Try
  220. End Function
  221. Public Shared Function SetRootNodeToXML(ByVal strXML As String) As String
  222. Return "<ROOT>" & strXML & "</ROOT>"
  223. End Function
  224. Public Shared Function RemoveRootNodeFromXML(ByVal strXML As String) As String
  225. Return Replace(Replace(strXML, "<ROOT>", ""), "</ROOT>", "")
  226. End Function
  227. Public Shared Function RemoveCDATAFromXML(ByVal strXML As String) As String
  228. If Left(strXML, 9) = "<![CDATA[" And Right(strXML, 3) = "]]>" Then
  229. RemoveCDATAFromXML = Mid(strXML, 10, strXML.Trim.Length - 12)
  230. Else
  231. RemoveCDATAFromXML = strXML
  232. End If
  233. End Function
  234. Public Shared Function SetCDATAToXML(ByVal strXML As String) As String
  235. Return "<![CDATA[" & strXML & "]]>"
  236. End Function
  237. Public Shared Function ClearAllSpecialCharFromXML(ByVal strXML As String) As String
  238. '.Net 2.0 Creates xml:space=""preserve" in dataset if data is blank
  239. Return Replace(Replace(Replace(Replace(Replace(Replace(strXML, "&amp;", "&"), "&apos;", "'"), "&quot;", """"), "&lt;", "<"), "&gt;", ">"), " xml:space=""preserve""", "")
  240. End Function
  241. Public Shared Function ClearLimitedSpecialCharFromXML(ByVal strXML As String) As String
  242. '.Net 2.0 Creates xml:space=""preserve" in dataset if data is blank
  243. Return Replace(Replace(Replace(Replace(strXML, "&lt;", "<"), "&gt;", ">"), "&amp;nbsp;", "&nbsp;"), " xml:space=""preserve""", "")
  244. End Function
  245. Public Shared Function GetInnerXMLOnRelativePath(ByVal strXML As String, ByVal strRelativePath As String) As String
  246. Dim xdcXML As New XmlDocument
  247. Dim strInnerXML As String = ""
  248. Try
  249. xdcXML.LoadXml(strXML)
  250. strInnerXML = xdcXML.SelectSingleNode(strRelativePath).InnerXml.ToString
  251. Catch
  252. strInnerXML = ""
  253. Finally
  254. GetInnerXMLOnRelativePath = strInnerXML
  255. End Try
  256. End Function
  257. Public Shared Function GetInnerTextOnRelativePath(ByVal strXML As String, ByVal strRelativePath As String) As String
  258. Dim xdcXML As New XmlDocument
  259. Dim strInnerText As String = ""
  260. Try
  261. xdcXML.LoadXml(strXML)
  262. strInnerText = xdcXML.SelectSingleNode(strRelativePath).InnerText.ToString
  263. Catch
  264. strInnerText = ""
  265. Finally
  266. GetInnerTextOnRelativePath = strInnerText
  267. End Try
  268. End Function
  269. Public Shared Function GetObjectAsXmlDocument(ByVal objObject As Object) As XmlDocument
  270. Dim xdcXML As New XmlDocument 'Convert the obj into an Xml document
  271. Dim dstXML As DataSet = New DataSet
  272. Try
  273. Dim xsrXML As XmlSerializer = New XmlSerializer(objObject.GetType())
  274. Dim sbrXML As StringBuilder = New StringBuilder
  275. Dim twrXML As TextWriter = New StringWriter(sbrXML)
  276. xsrXML.Serialize(twrXML, objObject)
  277. Dim srdReader As StringReader = New StringReader(twrXML.ToString())
  278. 'Read the Xml from the StringReader object
  279. dstXML.ReadXml(srdReader)
  280. xdcXML.LoadXml(dstXML.GetXml())
  281. Return xdcXML
  282. Catch
  283. Throw
  284. End Try
  285. End Function
  286. Public Shared Function GetXMLFromDataSet(ByVal strWebMethodName As String, _
  287. ByVal dstDataset As DataSet) As String
  288. Dim dtbFindTable As DataTable
  289. Dim dclTable As DataColumn
  290. Dim intCount As Integer = 1
  291. Dim strXML As String
  292. If dstDataset.Tables.Count > 0 Then
  293. For Each dtbFindTable In dstDataset.Tables
  294. If dstDataset.Tables.Count = 1 Then
  295. dtbFindTable.TableName = strWebMethodName & "_TABLE"
  296. For Each dclTable In dstDataset.Tables(0).Columns
  297. dclTable.ColumnName = UCase(dclTable.ColumnName)
  298. Next
  299. Else
  300. dtbFindTable.TableName = strWebMethodName & "_TABLE" & intCount
  301. For Each dclTable In dstDataset.Tables(intCount - 1).Columns
  302. dclTable.ColumnName = UCase(dclTable.ColumnName)
  303. Next
  304. intCount = intCount + 1
  305. End If
  306. Next
  307. dstDataset.DataSetName = strWebMethodName & "_DATASET"
  308. strXML = dstDataset.GetXml
  309. Else
  310. strXML = ""
  311. End If
  312. GetXMLFromDataSet = ClearLimitedSpecialCharFromXML(strXML)
  313. End Function
  314. Public Shared Function GetObjectAsDataSet(ByVal objObject As Object) As DataSet
  315. Dim xdcXML As New XmlDocument 'Convert the obj into an Xml document
  316. Dim dstXML As DataSet = New DataSet
  317. Try
  318. Dim xsrXML As XmlSerializer = New XmlSerializer(objObject.GetType())
  319. Dim sbrXML As StringBuilder = New StringBuilder
  320. Dim twrXML As TextWriter = New StringWriter(sbrXML)
  321. xsrXML.Serialize(twrXML, objObject)
  322. Dim srdReader As StringReader = New StringReader(twrXML.ToString())
  323. 'Read the Xml from the StringReader object
  324. dstXML.ReadXml(srdReader)
  325. xdcXML.LoadXml(dstXML.GetXml())
  326. Return dstXML
  327. Catch
  328. Throw
  329. End Try
  330. End Function
  331. Public Shared Function GetDataSetFromXMLString(ByVal strXML As String) As DataSet
  332. Dim dstXML As DataSet = New DataSet
  333. Try
  334. Dim srdXML As StringReader = New StringReader(strXML)
  335. dstXML.ReadXml(srdXML, XmlReadMode.Auto)
  336. Return dstXML
  337. Catch
  338. Throw
  339. End Try
  340. End Function
  341. End Class

 

Class : MyTransaction

Code Snippet
  1. Option Explicit On
  2. Option Strict On
  3. Public NotInheritable Class MyTransaction
  4. Private strTokenID As String
  5. Private strUserID As String
  6. Private strPassword As String
  7. Private strIPAddress As String
  8. Private intTransactionID As Int32
  9. Private strTransactionRefID As String
  10. Private dtmTransactionReqDate As DateTime
  11. Private dtmTransactionResDate As DateTime
  12. Private strTransactionReqXML As String
  13. Private strTransactionResXML As String
  14. Private strWebMethodName As String
  15. Private strWebMethodXML As String
  16. Private strWebMethodXMLData As String
  17. Private intMessageNo As Int32
  18. Private strMessageModule As String
  19. Private strMessageDetail As String
  20. #Region "Private Constructor"
  21. Sub New()
  22. End Sub
  23. #End Region
  24. Public Property TokenID() As String
  25. Get
  26. If IsNothing(strTokenID) Then strTokenID = ""
  27. Return strTokenID
  28. End Get
  29. Set(ByVal Value As String)
  30. strTokenID = Value
  31. End Set
  32. End Property
  33. Public Property UserID() As String
  34. Get
  35. If IsNothing(strUserID) Then strUserID = ""
  36. Return strUserID
  37. End Get
  38. Set(ByVal Value As String)
  39. strUserID = Value
  40. End Set
  41. End Property
  42. Public Property UserPassword() As String
  43. Get
  44. If IsNothing(strPassword) Then strPassword = ""
  45. Return strPassword
  46. End Get
  47. Set(ByVal Value As String)
  48. strPassword = Value
  49. End Set
  50. End Property
  51. Public Property IPAddress() As String
  52. Get
  53. If IsNothing(strIPAddress) Then strIPAddress = ""
  54. Return strIPAddress
  55. End Get
  56. Set(ByVal Value As String)
  57. strIPAddress = Value
  58. End Set
  59. End Property
  60. Public Property TransactionID() As Int32
  61. Get
  62. Return intTransactionID
  63. End Get
  64. Set(ByVal Value As Int32)
  65. intTransactionID = Value
  66. End Set
  67. End Property
  68. Public Property TransactionRefID() As String
  69. Get
  70. If IsNothing(strTransactionRefID) Then strTransactionRefID = ""
  71. Return strTransactionRefID
  72. End Get
  73. Set(ByVal Value As String)
  74. strTransactionRefID = Value
  75. End Set
  76. End Property
  77. Public Property TransactionRequestDate() As Date
  78. Get
  79. If DateDiff(DateInterval.Day, dtmTransactionReqDate, DateAndTime.Now) <> 0 Then dtmTransactionReqDate = DateAndTime.Now
  80. Return dtmTransactionReqDate
  81. End Get
  82. Set(ByVal dtmValue As Date)
  83. dtmTransactionReqDate = dtmValue
  84. End Set
  85. End Property
  86. Public Property TransactionResponseDate() As Date
  87. Get
  88. If DateDiff(DateInterval.Second, dtmTransactionResDate, DateAndTime.Now) <> 0 Then dtmTransactionResDate = DateAndTime.Now
  89. Return dtmTransactionResDate
  90. End Get
  91. Set(ByVal dtmValue As Date)
  92. dtmTransactionResDate = dtmValue
  93. End Set
  94. End Property
  95. Public Property TransactionRequestXML() As String
  96. Get
  97. If IsNothing(strTransactionReqXML) Then strTransactionReqXML = ""
  98. Return strTransactionReqXML
  99. End Get
  100. Set(ByVal Value As String)
  101. strTransactionReqXML = Value
  102. End Set
  103. End Property
  104. Public Property TransactionResponseXML() As String
  105. Get
  106. If IsNothing(strTransactionResXML) Then strTransactionResXML = ""
  107. Return strTransactionResXML
  108. End Get
  109. Set(ByVal Value As String)
  110. strTransactionResXML = Value
  111. End Set
  112. End Property
  113. Public Property WebMethodName() As String
  114. Get
  115. If IsNothing(strWebMethodName) Then strWebMethodName = ""
  116. Return strWebMethodName
  117. End Get
  118. Set(ByVal Value As String)
  119. strWebMethodName = Value
  120. End Set
  121. End Property
  122. Public Property WebMethodXML() As String
  123. Get
  124. If IsNothing(strWebMethodXML) Then strWebMethodXML = ""
  125. Return Helper.RemoveCDATAFromXML(strWebMethodXML)
  126. End Get
  127. Set(ByVal Value As String)
  128. strWebMethodXML = Value
  129. End Set
  130. End Property
  131. Public Property WebMethodXMLData() As String
  132. Get
  133. If IsNothing(strWebMethodXMLData) Then strWebMethodXMLData = ""
  134. Return Helper.RemoveCDATAFromXML(strWebMethodXMLData)
  135. End Get
  136. Set(ByVal Value As String)
  137. strWebMethodXMLData = Value
  138. End Set
  139. End Property
  140. Public Property MessageNumber() As Int32
  141. Get
  142. Return intMessageNo
  143. End Get
  144. Set(ByVal Value As Int32)
  145. intMessageNo = Value
  146. End Set
  147. End Property
  148. Public Property MessageModule() As String
  149. Get
  150. If IsNothing(strMessageModule) Then strMessageModule = ""
  151. Return strMessageModule
  152. End Get
  153. Set(ByVal Value As String)
  154. strMessageModule = Value
  155. End Set
  156. End Property
  157. Public Property MessageDetail() As String
  158. Get
  159. If IsNothing(strMessageDetail) Then strMessageDetail = ""
  160. Return Helper.RemoveCDATAFromXML(strMessageDetail)
  161. End Get
  162. Set(ByVal Value As String)
  163. strMessageDetail = Value
  164. End Set
  165. End Property
  166. End Class

No comments: