Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions WebServiceStudio/MessageTracer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,16 @@ internal static string ReadMessage(Stream from, int len, string contentType)
if ((contentType.StartsWith("text/xml") || contentType.StartsWith("application/soap+xml")) ||
(contentType == "http://schemas.xmlsoap.org/soap/envelope/"))
{
byte[] bytes = ReadStream(from, len);
var document = new XmlDocument();
document.InnerXml = GetEncoding(contentType).GetString(bytes);
XmlDocument document = new XmlDocument();
if (len >= 0)
{
byte[] bytes = ReadStream(from, len);
document.InnerXml = GetEncoding(contentType).GetString(bytes);
}
else
{
document = ReadStream(from, GetEncoding(contentType));
}
var w = new StringWriter();
var writer2 = new XmlTextWriter(w);
writer2.Formatting = Formatting.Indented;
Expand Down Expand Up @@ -173,6 +180,16 @@ private static byte[] ReadStream(Stream stream, int len)
}
return destinationArray;
}

private static XmlDocument ReadStream(Stream stream, Encoding encoder)
{
StreamReader sr = new StreamReader(stream, encoder);
String retXml = sr.ReadToEnd();
sr.Close();
XmlDocument doc = new XmlDocument();
doc.LoadXml(retXml);
return doc;
}

internal static int WriteMessage(Stream stream, string contentType, string str)
{
Expand Down