W
William
I have a strongly typed XML document created with xsd.exe. I have a web
request that returns an xml document as a byte[]. I would like to desearlize
the return byte array but not quite sure how. I am thinking of something
like:
TstRequest trqst= new TstFloodRequest();
CreateRequest(trqst); //populate the request document
WebClient wc = new WebClient();
MemoryStream ms = new MemoryStream();
XmlSerializer s1 = new XmlSerializer(typeof(TstRequest));
s1.Serialize(ms, trqst);
string req = Encoding.UTF8.GetString(ms.ToArray());
byte[] ret = ws.UploadData("http://testcompany.cgi", "POST",
Encoding.UTF8.GetBytes(req));
TstResponse trsp = new TstResponse ();
XmlSerializer s2 = new XmlSerializer(typeof(TstResponse));
s2.Deserialize(???); // I am trying to populate trsp with the returned
byte[] but not quite sure how to go about it.
request that returns an xml document as a byte[]. I would like to desearlize
the return byte array but not quite sure how. I am thinking of something
like:
TstRequest trqst= new TstFloodRequest();
CreateRequest(trqst); //populate the request document
WebClient wc = new WebClient();
MemoryStream ms = new MemoryStream();
XmlSerializer s1 = new XmlSerializer(typeof(TstRequest));
s1.Serialize(ms, trqst);
string req = Encoding.UTF8.GetString(ms.ToArray());
byte[] ret = ws.UploadData("http://testcompany.cgi", "POST",
Encoding.UTF8.GetBytes(req));
TstResponse trsp = new TstResponse ();
XmlSerializer s2 = new XmlSerializer(typeof(TstResponse));
s2.Deserialize(???); // I am trying to populate trsp with the returned
byte[] but not quite sure how to go about it.