I am receiving an error:
"Use of unassigned local variable 'PostData'"
when compiling the following statements below within a method. My intent is take a "string" value containing an XML SOAP header and convert it to a XMLDictionaryWriter
object. See my code below:
Stream PostData;
byte[] buffer = Encoding.ASCII.GetBytes(x509.CreateX509SoapEnvelope());
PostData.Write(buffer, 0, buffer.Length); // error here
XmlDictionaryWriter xmlwriter = XmlDictionaryWriter.CreateTextWriter(PostData, Encoding.ASCII);
request.Headers.WriteHeaderContents(0,xmlwriter);
FYI, the output of x509.CreateX509SoapEnvelope()
is a string and I tested that part and it works. I marked the code above to show where the error occurs.Need assistance with the error and how to fix it ?