Response object:
{
"Integrator": "ARVY",
"MessageType": "AgentStoredProcMessage",
"MessageTagId": "ARVY-000000108",
"QueryResults": "|
|
",
"OutParams": "{\"Parameters\":null,\"ReturnValue\":0}",
"Results": true,
"StatusCode": 200,
"ExceptionMessage": null,
"BaseExceptionMessage": null,
"ResponseMessageCount": 0,
"ResponseMessages": [],
"ProcessingDate": "2023-10-04 19:44:46Z"
}
To read the Query Results as valid XML, add a and elements around the QueryResults, which would yield xml that looks like (after removing the escape characters and adding some readability formatting):
// <-- Notice the escaped ampersand (xml requires it to be escaped)
The above example came from this SQL:
select PriKey, Name = Commodity from CommType
PriKey Name
----------- --------------------------
3 2/3 PROV
1 Auto
13 DIST
6 ELECT
2 HHG
14 HHG Atlas
8 HVP
7 NONE
4 O&I // <-- Notice the ampersand
12 RS
5 TS
(11 rows affected)
// Sample C# snipet of how to process the returned XML string as a C# XDocument object:
var theXmlString = "|
|
";
var theXDoc = XDocument.Parse( $"{theXmlString}" );
var theRowCounter = 1;
foreach ( var theElement in theXDoc.Elements("root").Elements("row" ) )
{
var theData = $"Row {theRowCounter}: PriKey={theElement.Attribute("PriKey").Value}, Name={theElement.Attribute("Name").Value}";
theData.Dump();
theRowCounter++;
}
// Produces this output (assume the Dump() method spits out the string's content):
Row 1: PriKey=3, Name=2/3 PROV
Row 2: PriKey=1, Name=Auto
Row 3: PriKey=13, Name=DIST
Row 4: PriKey=6, Name=ELECT
Row 5: PriKey=2, Name=HHG
Row 6: PriKey=14, Name=HHG Atlas
Row 7: PriKey=8, Name=HVP
Row 8: PriKey=7, Name=NONE
Row 9: PriKey=4, Name=O&I // <-- Notice how the XML escaped ampersand was automatically handled correctly.
Row 10: PriKey=12, Name=RS
Row 11: PriKey=5, Name=TS
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|