BizTalk Blog by Chris Han

System Design for Enterprise Agility,

  Home  |   Contact  |   Syndication    |   Login
  67 Posts | 9 Stories | 138 Comments | 79 Trackbacks

News

Article Categories

Archives

Post Categories

Image Galleries

BizTalk Bloggers

BizTalk on MSDN

Patterns & Architecture

SharePoint

I'm using Thinkteture's tool for my 'contract-first' web service project. It's all cool except the 'access message' doesn't seem work. So I have to write this small utility function to log. It's nothing but an XML-object serialization work. Another tool called fiddler2 www.fiddler2.com/fiddler2/ you may want to check out. Really handy when wonder what's actually being past on wire.  

public static void LogXmlMessage(string FeedName,Object RequestResponse, int NewFeedID)XmlSerializerNamespaces xNs = new XmlSerializerNamespaces();"xs", @"http://www.w3.org/2001/XMLSchema-instance");"ivt", @"http://www.csfb.com/Investran");"csfb", @"http://www.csfb.com/");"eai", @"http://www.csfb.com/eai/v2");Type ObjectType = RequestResponse.GetType();

#region

 

SerizalizationWork//XmlSerializer xSerializer = new XmlSerializer(typeof(GetFeedResponse));

 

 

 

{

xSerializer.Serialize(w, RequestResponse, xNs);

w.Seek(0, System.IO.

XmlSerializer xSerializer = new XmlSerializer(ObjectType);XmlDocument xDoc = new XmlDocument();using (System.IO.MemoryStream w = new System.IO.MemoryStream())SeekOrigin.Begin);// rewind after write.

xDoc.Load(w);

w.Close();

}

 

 

string XmlString = xDoc.InnerXml;DalCommon.ProcessLog(string.Format("{0} {1} Xml Created", FeedName, ObjectType.Name), XmlString, null, NewFeedID > 0 ? (int?)NewFeedID : null);

#endregion

}

{

 

xNs.Add(

xNs.Add(

xNs.Add(

xNs.Add(

 

posted on Tuesday, July 29, 2008 5:19 PM